You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by mark goldin <ma...@gmail.com> on 2013/07/12 23:18:32 UTC

Search for text in DataGrid's column

I need to come up with a solution for searching a text in a column. What I
have now is clearly showing that the following function in the item
renderer:
private function onTextSearchEvent(event:ApplicantformTextSearchEvent):void
{
var _startingPosition:int = Question.text.search(event.textToSearch);
trace(_startingPosition);
if (_startingPosition != -1)
{
Question.selectRange(_startingPosition, _startingPosition +
event.textToSearch.length);
}
}

does not print dataPrvider.length times as what I would want. But how can I
show a number of text instances being found if it does not go thru every
row in the datagrid?

Re: Search for text in DataGrid's column

Posted by mark goldin <ma...@gmail.com>.
I have solved the problem using search inside of the item renderer.
Something like this, simplified:

<?xml version="1.0" encoding="utf-8"?>
<s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
  xmlns:s="library://ns.adobe.com/flex/spark"
  xmlns:mx="library://ns.adobe.com/flex/mx"
  xmlns:gridEditorClasses="spark.components.gridEditorClasses.*"
  >
 <fx:Script>
<![CDATA[
override public function set data(value:Object):void
{
super.data = value;
if (data)
{
Question.text = data[column.dataField];
}
}
override public function prepare(hasBeenRecycled:Boolean):void
{
super.prepare(hasBeenRecycled);
if (data)
{
if (column.dataField == "QuestionText")
{
var _textTosearch:String = (column.grid.dataGrid as
ApplicantFormQuestionDataGrid).textToSearch;
var _textInstanceIndex:int = (column.grid.dataGrid as
ApplicantFormQuestionDataGrid).textInstanceIndex;
if (_textTosearch && _textTosearch != "")
{
var _startSelection:int = Question.text.search(_textTosearch);
var _endSelection:int = _startSelection + _textTosearch.length;
Question.selectRange(_startSelection, _endSelection);
if (_startSelection != -1)
{
column.grid.dataGrid.ensureCellIsVisible(_textInstanceIndex);

if (rowIndex == _textInstanceIndex)
{
Question.setStyle("unfocusedTextSelectionColor", "#FFD700");
}
else
Question.setStyle("unfocusedTextSelectionColor", "#808080");
}
}
Question.width = column.width;
mainGroup.width = column.width;
}
}
}
]]>
</fx:Script>
 <!--- The renderer's visual component. -->
<s:VGroup width="100%" gap="0" id="mainGroup">
<s:RichEditableText id="Question" verticalAlign="top" paddingTop="10"
paddingBottom="10" width="100%"
editable="false" unfocusedTextSelectionColor="gray"
focusedTextSelectionColor="#FFD700"
fontSize="{column.grid.dataGrid.getStyle('fontSize')}" paddingLeft="10"
selectionHighlighting="always"/>
</s:VGroup>
</s:GridItemRenderer>

This renderer does two things. It highlights text instances in gray color
and it allows a user to navigate thru the instances highlighting it in
gold. everything works fine. But here is another problem. If I try to
scroll datagrid by clicking on down error it's not going anywhere because
of column.grid.dataGrid.ensureCellIsVisible(_textInstanceIndex);
How could I solve this problem?

Thanks

Re: Search for text in DataGrid's column

Posted by jude <fl...@gmail.com>.
you could extend the model to include text selection coordinates but if
that triggers a save you could create a dictionary for data that
has selection coordinates.

on prepare or set data of the item renderer check if selection data exists
for the given item:

// pseudo code
var selectionData:Array = Manager.getInstance().selectionDictionary[data];

if (selectionData) richText.
setSelection(selectionData[0],selectionData[1]);

you would have had to have stored that data previously.

On Monday, July 15, 2013, Gary Young wrote:

> Just want to clarify that I meant the itemRenderer should TRIGER the
> refreshing, the actual refresh code should be in the model, which in this
> case, should be itemRenderer's data. -Gary
>
>
> On Mon, Jul 15, 2013 at 4:06 PM, mark goldin <ma...@gmail.com>
> wrote:
>
> > That's exactly how I have done it. But like I said, the problem is that I
> > am modifying data model and that will cause a prompt for data save.
> >
> >
> > On Mon, Jul 15, 2013 at 3:02 PM, Les Bantleman <
> lesliebantleman@gmail.com
> > >wrote:
> >
> > > Hi Mark,
> > >
> > > Idealy the itemRenderer should be responsible for renderering (not
> > > searching). Have you considered adding a property to the data row
> object
> > > which can be used to flag if the row matches the search term? A search
> > > procedure could iterate the dataProvider updating this (boolean) flag.
> > The
> > > renderer could then simply highlight search matches based on the flag.
> > Just
> > > an idea.
> > >
> > > Les
> > >
> > >
> > >
> > > On 15 July 2013 19:35, mark goldin <ma...@gmail.com> wrote:
> > >
> > > > Here is my problem. I need to keep data that would drive text
> selection
> > > > somewhere. Ideal place is a dataProvider. But using dataProvider
> > creates
> > > > another problem. Change manager reports about data being changed,
> > > because I
> > > > am updating dataProvider. How can I avoid using datagrid's
> dataProvider
> > > for
> > > > storing text highlights coordinates?
> > > >
> > > > Thanks
> > > >
> > > >
> > > > On Fri, Jul 12, 2013 at 9:10 PM, Gary Young <fl...@gmail.com>
> > > > wrote:
> > > >
> > > > > I think Alex is right, each renderer instance should do the search
> by
> > > > self,
> > > > > because of virtual layout, datagrid only keep creating/reusing the
> > > > renderer
> > > > > insts in the visible area, so the performance will be great. -Gary
> > > > >
> > > > >
> > > > > On Fri, Jul 12, 2013 at 9:57 PM, mark goldin <
> markzolotoy@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > That means I need to store selection coordinates somewhere in the
> > > > > > dataProvider to reapply selection every time datagrid is
> scrolled.
> > Is
> > > > > that
> > > > > > correct?
> > > > > >
> > > > > >
> > > > > > On Fri, Jul 12, 2013 at 8:08 PM, Alex Harui <ah...@adobe.com>
> > > wrote:
> > > > > >
> > > > > > > The principle of virtual renderers is that they would do their
> > > > > > > highlighting as they get scrolled onto the screen, not all at
> > once.
> > > > > > >
> > > > > > > On 7/12/13 5:11 PM, "mark goldin" <ma...@gmail.com>
> wrote:
> > > > > > >
> > > > > > > >No, I am not filtering dataprovider. I need to search thru all
> > > cells
> > > > > in
> > > > > > > >the
> > > > > > > >column and highlight all instances of search text at once. Can
> > be
> > > > > > hundreds
> > > > > > > >of rows.
> > > > > > > >
> > > > > > > >
> > > > > > > >On Fri, Jul 12, 2013 at 5:40 PM, Alex Harui <aharui@adobe.com
> >
> > > > wrote:
> > > > > > > >
> > > > > > > >> I'm not sure what are you trying to accomplish.  You could
> > > filter
> > > > > the
> > > > > > > >> dataprovider so that only rows with text hits are shown in
> the
> > > DG.
> > > > > >  That
> > > > > > > >> code would not be in the renderer.  Otherwise, code in the
> > > > renderer
> > > > > > that
> > >

Re: Search for text in DataGrid's column

Posted by Gary Young <fl...@gmail.com>.
Just want to clarify that I meant the itemRenderer should TRIGER the
refreshing, the actual refresh code should be in the model, which in this
case, should be itemRenderer's data. -Gary


On Mon, Jul 15, 2013 at 4:06 PM, mark goldin <ma...@gmail.com> wrote:

> That's exactly how I have done it. But like I said, the problem is that I
> am modifying data model and that will cause a prompt for data save.
>
>
> On Mon, Jul 15, 2013 at 3:02 PM, Les Bantleman <lesliebantleman@gmail.com
> >wrote:
>
> > Hi Mark,
> >
> > Idealy the itemRenderer should be responsible for renderering (not
> > searching). Have you considered adding a property to the data row object
> > which can be used to flag if the row matches the search term? A search
> > procedure could iterate the dataProvider updating this (boolean) flag.
> The
> > renderer could then simply highlight search matches based on the flag.
> Just
> > an idea.
> >
> > Les
> >
> >
> >
> > On 15 July 2013 19:35, mark goldin <ma...@gmail.com> wrote:
> >
> > > Here is my problem. I need to keep data that would drive text selection
> > > somewhere. Ideal place is a dataProvider. But using dataProvider
> creates
> > > another problem. Change manager reports about data being changed,
> > because I
> > > am updating dataProvider. How can I avoid using datagrid's dataProvider
> > for
> > > storing text highlights coordinates?
> > >
> > > Thanks
> > >
> > >
> > > On Fri, Jul 12, 2013 at 9:10 PM, Gary Young <fl...@gmail.com>
> > > wrote:
> > >
> > > > I think Alex is right, each renderer instance should do the search by
> > > self,
> > > > because of virtual layout, datagrid only keep creating/reusing the
> > > renderer
> > > > insts in the visible area, so the performance will be great. -Gary
> > > >
> > > >
> > > > On Fri, Jul 12, 2013 at 9:57 PM, mark goldin <ma...@gmail.com>
> > > > wrote:
> > > >
> > > > > That means I need to store selection coordinates somewhere in the
> > > > > dataProvider to reapply selection every time datagrid is scrolled.
> Is
> > > > that
> > > > > correct?
> > > > >
> > > > >
> > > > > On Fri, Jul 12, 2013 at 8:08 PM, Alex Harui <ah...@adobe.com>
> > wrote:
> > > > >
> > > > > > The principle of virtual renderers is that they would do their
> > > > > > highlighting as they get scrolled onto the screen, not all at
> once.
> > > > > >
> > > > > > On 7/12/13 5:11 PM, "mark goldin" <ma...@gmail.com> wrote:
> > > > > >
> > > > > > >No, I am not filtering dataprovider. I need to search thru all
> > cells
> > > > in
> > > > > > >the
> > > > > > >column and highlight all instances of search text at once. Can
> be
> > > > > hundreds
> > > > > > >of rows.
> > > > > > >
> > > > > > >
> > > > > > >On Fri, Jul 12, 2013 at 5:40 PM, Alex Harui <ah...@adobe.com>
> > > wrote:
> > > > > > >
> > > > > > >> I'm not sure what are you trying to accomplish.  You could
> > filter
> > > > the
> > > > > > >> dataprovider so that only rows with text hits are shown in the
> > DG.
> > > > >  That
> > > > > > >> code would not be in the renderer.  Otherwise, code in the
> > > renderer
> > > > > that
> > > > > > >> finds text hits in the data item it is responsible for should
> > only
> > > > be
> > > > > > >> called for visible rows if you are using virtual layout.
> > > > > > >>
> > > > > > >> On 7/12/13 2:18 PM, "mark goldin" <ma...@gmail.com>
> > wrote:
> > > > > > >>
> > > > > > >> >I need to come up with a solution for searching a text in a
> > > column.
> > > > > > >>What I
> > > > > > >> >have now is clearly showing that the following function in
> the
> > > item
> > > > > > >> >renderer:
> > > > > > >> >private function
> > > > > > >> >onTextSearchEvent(event:ApplicantformTextSearchEvent):void
> > > > > > >> >{
> > > > > > >> >var _startingPosition:int =
> > > > Question.text.search(event.textToSearch);
> > > > > > >> >trace(_startingPosition);
> > > > > > >> >if (_startingPosition != -1)
> > > > > > >> >{
> > > > > > >> >Question.selectRange(_startingPosition, _startingPosition +
> > > > > > >> >event.textToSearch.length);
> > > > > > >> >}
> > > > > > >> >}
> > > > > > >> >
> > > > > > >> >does not print dataPrvider.length times as what I would want.
> > But
> > > > how
> > > > > > >>can
> > > > > > >> >I
> > > > > > >> >show a number of text instances being found if it does not go
> > > thru
> > > > > > >>every
> > > > > > >> >row in the datagrid?
> > > > > > >>
> > > > > > >>
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: Search for text in DataGrid's column

Posted by mark goldin <ma...@gmail.com>.
That's exactly how I have done it. But like I said, the problem is that I
am modifying data model and that will cause a prompt for data save.


On Mon, Jul 15, 2013 at 3:02 PM, Les Bantleman <le...@gmail.com>wrote:

> Hi Mark,
>
> Idealy the itemRenderer should be responsible for renderering (not
> searching). Have you considered adding a property to the data row object
> which can be used to flag if the row matches the search term? A search
> procedure could iterate the dataProvider updating this (boolean) flag. The
> renderer could then simply highlight search matches based on the flag. Just
> an idea.
>
> Les
>
>
>
> On 15 July 2013 19:35, mark goldin <ma...@gmail.com> wrote:
>
> > Here is my problem. I need to keep data that would drive text selection
> > somewhere. Ideal place is a dataProvider. But using dataProvider creates
> > another problem. Change manager reports about data being changed,
> because I
> > am updating dataProvider. How can I avoid using datagrid's dataProvider
> for
> > storing text highlights coordinates?
> >
> > Thanks
> >
> >
> > On Fri, Jul 12, 2013 at 9:10 PM, Gary Young <fl...@gmail.com>
> > wrote:
> >
> > > I think Alex is right, each renderer instance should do the search by
> > self,
> > > because of virtual layout, datagrid only keep creating/reusing the
> > renderer
> > > insts in the visible area, so the performance will be great. -Gary
> > >
> > >
> > > On Fri, Jul 12, 2013 at 9:57 PM, mark goldin <ma...@gmail.com>
> > > wrote:
> > >
> > > > That means I need to store selection coordinates somewhere in the
> > > > dataProvider to reapply selection every time datagrid is scrolled. Is
> > > that
> > > > correct?
> > > >
> > > >
> > > > On Fri, Jul 12, 2013 at 8:08 PM, Alex Harui <ah...@adobe.com>
> wrote:
> > > >
> > > > > The principle of virtual renderers is that they would do their
> > > > > highlighting as they get scrolled onto the screen, not all at once.
> > > > >
> > > > > On 7/12/13 5:11 PM, "mark goldin" <ma...@gmail.com> wrote:
> > > > >
> > > > > >No, I am not filtering dataprovider. I need to search thru all
> cells
> > > in
> > > > > >the
> > > > > >column and highlight all instances of search text at once. Can be
> > > > hundreds
> > > > > >of rows.
> > > > > >
> > > > > >
> > > > > >On Fri, Jul 12, 2013 at 5:40 PM, Alex Harui <ah...@adobe.com>
> > wrote:
> > > > > >
> > > > > >> I'm not sure what are you trying to accomplish.  You could
> filter
> > > the
> > > > > >> dataprovider so that only rows with text hits are shown in the
> DG.
> > > >  That
> > > > > >> code would not be in the renderer.  Otherwise, code in the
> > renderer
> > > > that
> > > > > >> finds text hits in the data item it is responsible for should
> only
> > > be
> > > > > >> called for visible rows if you are using virtual layout.
> > > > > >>
> > > > > >> On 7/12/13 2:18 PM, "mark goldin" <ma...@gmail.com>
> wrote:
> > > > > >>
> > > > > >> >I need to come up with a solution for searching a text in a
> > column.
> > > > > >>What I
> > > > > >> >have now is clearly showing that the following function in the
> > item
> > > > > >> >renderer:
> > > > > >> >private function
> > > > > >> >onTextSearchEvent(event:ApplicantformTextSearchEvent):void
> > > > > >> >{
> > > > > >> >var _startingPosition:int =
> > > Question.text.search(event.textToSearch);
> > > > > >> >trace(_startingPosition);
> > > > > >> >if (_startingPosition != -1)
> > > > > >> >{
> > > > > >> >Question.selectRange(_startingPosition, _startingPosition +
> > > > > >> >event.textToSearch.length);
> > > > > >> >}
> > > > > >> >}
> > > > > >> >
> > > > > >> >does not print dataPrvider.length times as what I would want.
> But
> > > how
> > > > > >>can
> > > > > >> >I
> > > > > >> >show a number of text instances being found if it does not go
> > thru
> > > > > >>every
> > > > > >> >row in the datagrid?
> > > > > >>
> > > > > >>
> > > > >
> > > > >
> > > >
> > >
> >
>

Re: Search for text in DataGrid's column

Posted by Les Bantleman <le...@gmail.com>.
Hi Mark,

Idealy the itemRenderer should be responsible for renderering (not
searching). Have you considered adding a property to the data row object
which can be used to flag if the row matches the search term? A search
procedure could iterate the dataProvider updating this (boolean) flag. The
renderer could then simply highlight search matches based on the flag. Just
an idea.

Les



On 15 July 2013 19:35, mark goldin <ma...@gmail.com> wrote:

> Here is my problem. I need to keep data that would drive text selection
> somewhere. Ideal place is a dataProvider. But using dataProvider creates
> another problem. Change manager reports about data being changed, because I
> am updating dataProvider. How can I avoid using datagrid's dataProvider for
> storing text highlights coordinates?
>
> Thanks
>
>
> On Fri, Jul 12, 2013 at 9:10 PM, Gary Young <fl...@gmail.com>
> wrote:
>
> > I think Alex is right, each renderer instance should do the search by
> self,
> > because of virtual layout, datagrid only keep creating/reusing the
> renderer
> > insts in the visible area, so the performance will be great. -Gary
> >
> >
> > On Fri, Jul 12, 2013 at 9:57 PM, mark goldin <ma...@gmail.com>
> > wrote:
> >
> > > That means I need to store selection coordinates somewhere in the
> > > dataProvider to reapply selection every time datagrid is scrolled. Is
> > that
> > > correct?
> > >
> > >
> > > On Fri, Jul 12, 2013 at 8:08 PM, Alex Harui <ah...@adobe.com> wrote:
> > >
> > > > The principle of virtual renderers is that they would do their
> > > > highlighting as they get scrolled onto the screen, not all at once.
> > > >
> > > > On 7/12/13 5:11 PM, "mark goldin" <ma...@gmail.com> wrote:
> > > >
> > > > >No, I am not filtering dataprovider. I need to search thru all cells
> > in
> > > > >the
> > > > >column and highlight all instances of search text at once. Can be
> > > hundreds
> > > > >of rows.
> > > > >
> > > > >
> > > > >On Fri, Jul 12, 2013 at 5:40 PM, Alex Harui <ah...@adobe.com>
> wrote:
> > > > >
> > > > >> I'm not sure what are you trying to accomplish.  You could filter
> > the
> > > > >> dataprovider so that only rows with text hits are shown in the DG.
> > >  That
> > > > >> code would not be in the renderer.  Otherwise, code in the
> renderer
> > > that
> > > > >> finds text hits in the data item it is responsible for should only
> > be
> > > > >> called for visible rows if you are using virtual layout.
> > > > >>
> > > > >> On 7/12/13 2:18 PM, "mark goldin" <ma...@gmail.com> wrote:
> > > > >>
> > > > >> >I need to come up with a solution for searching a text in a
> column.
> > > > >>What I
> > > > >> >have now is clearly showing that the following function in the
> item
> > > > >> >renderer:
> > > > >> >private function
> > > > >> >onTextSearchEvent(event:ApplicantformTextSearchEvent):void
> > > > >> >{
> > > > >> >var _startingPosition:int =
> > Question.text.search(event.textToSearch);
> > > > >> >trace(_startingPosition);
> > > > >> >if (_startingPosition != -1)
> > > > >> >{
> > > > >> >Question.selectRange(_startingPosition, _startingPosition +
> > > > >> >event.textToSearch.length);
> > > > >> >}
> > > > >> >}
> > > > >> >
> > > > >> >does not print dataPrvider.length times as what I would want. But
> > how
> > > > >>can
> > > > >> >I
> > > > >> >show a number of text instances being found if it does not go
> thru
> > > > >>every
> > > > >> >row in the datagrid?
> > > > >>
> > > > >>
> > > >
> > > >
> > >
> >
>

Re: Search for text in DataGrid's column

Posted by mark goldin <ma...@gmail.com>.
Here is my problem. I need to keep data that would drive text selection
somewhere. Ideal place is a dataProvider. But using dataProvider creates
another problem. Change manager reports about data being changed, because I
am updating dataProvider. How can I avoid using datagrid's dataProvider for
storing text highlights coordinates?

Thanks


On Fri, Jul 12, 2013 at 9:10 PM, Gary Young <fl...@gmail.com> wrote:

> I think Alex is right, each renderer instance should do the search by self,
> because of virtual layout, datagrid only keep creating/reusing the renderer
> insts in the visible area, so the performance will be great. -Gary
>
>
> On Fri, Jul 12, 2013 at 9:57 PM, mark goldin <ma...@gmail.com>
> wrote:
>
> > That means I need to store selection coordinates somewhere in the
> > dataProvider to reapply selection every time datagrid is scrolled. Is
> that
> > correct?
> >
> >
> > On Fri, Jul 12, 2013 at 8:08 PM, Alex Harui <ah...@adobe.com> wrote:
> >
> > > The principle of virtual renderers is that they would do their
> > > highlighting as they get scrolled onto the screen, not all at once.
> > >
> > > On 7/12/13 5:11 PM, "mark goldin" <ma...@gmail.com> wrote:
> > >
> > > >No, I am not filtering dataprovider. I need to search thru all cells
> in
> > > >the
> > > >column and highlight all instances of search text at once. Can be
> > hundreds
> > > >of rows.
> > > >
> > > >
> > > >On Fri, Jul 12, 2013 at 5:40 PM, Alex Harui <ah...@adobe.com> wrote:
> > > >
> > > >> I'm not sure what are you trying to accomplish.  You could filter
> the
> > > >> dataprovider so that only rows with text hits are shown in the DG.
> >  That
> > > >> code would not be in the renderer.  Otherwise, code in the renderer
> > that
> > > >> finds text hits in the data item it is responsible for should only
> be
> > > >> called for visible rows if you are using virtual layout.
> > > >>
> > > >> On 7/12/13 2:18 PM, "mark goldin" <ma...@gmail.com> wrote:
> > > >>
> > > >> >I need to come up with a solution for searching a text in a column.
> > > >>What I
> > > >> >have now is clearly showing that the following function in the item
> > > >> >renderer:
> > > >> >private function
> > > >> >onTextSearchEvent(event:ApplicantformTextSearchEvent):void
> > > >> >{
> > > >> >var _startingPosition:int =
> Question.text.search(event.textToSearch);
> > > >> >trace(_startingPosition);
> > > >> >if (_startingPosition != -1)
> > > >> >{
> > > >> >Question.selectRange(_startingPosition, _startingPosition +
> > > >> >event.textToSearch.length);
> > > >> >}
> > > >> >}
> > > >> >
> > > >> >does not print dataPrvider.length times as what I would want. But
> how
> > > >>can
> > > >> >I
> > > >> >show a number of text instances being found if it does not go thru
> > > >>every
> > > >> >row in the datagrid?
> > > >>
> > > >>
> > >
> > >
> >
>

Re: Search for text in DataGrid's column

Posted by Gary Young <fl...@gmail.com>.
I think Alex is right, each renderer instance should do the search by self,
because of virtual layout, datagrid only keep creating/reusing the renderer
insts in the visible area, so the performance will be great. -Gary


On Fri, Jul 12, 2013 at 9:57 PM, mark goldin <ma...@gmail.com> wrote:

> That means I need to store selection coordinates somewhere in the
> dataProvider to reapply selection every time datagrid is scrolled. Is that
> correct?
>
>
> On Fri, Jul 12, 2013 at 8:08 PM, Alex Harui <ah...@adobe.com> wrote:
>
> > The principle of virtual renderers is that they would do their
> > highlighting as they get scrolled onto the screen, not all at once.
> >
> > On 7/12/13 5:11 PM, "mark goldin" <ma...@gmail.com> wrote:
> >
> > >No, I am not filtering dataprovider. I need to search thru all cells in
> > >the
> > >column and highlight all instances of search text at once. Can be
> hundreds
> > >of rows.
> > >
> > >
> > >On Fri, Jul 12, 2013 at 5:40 PM, Alex Harui <ah...@adobe.com> wrote:
> > >
> > >> I'm not sure what are you trying to accomplish.  You could filter the
> > >> dataprovider so that only rows with text hits are shown in the DG.
>  That
> > >> code would not be in the renderer.  Otherwise, code in the renderer
> that
> > >> finds text hits in the data item it is responsible for should only be
> > >> called for visible rows if you are using virtual layout.
> > >>
> > >> On 7/12/13 2:18 PM, "mark goldin" <ma...@gmail.com> wrote:
> > >>
> > >> >I need to come up with a solution for searching a text in a column.
> > >>What I
> > >> >have now is clearly showing that the following function in the item
> > >> >renderer:
> > >> >private function
> > >> >onTextSearchEvent(event:ApplicantformTextSearchEvent):void
> > >> >{
> > >> >var _startingPosition:int = Question.text.search(event.textToSearch);
> > >> >trace(_startingPosition);
> > >> >if (_startingPosition != -1)
> > >> >{
> > >> >Question.selectRange(_startingPosition, _startingPosition +
> > >> >event.textToSearch.length);
> > >> >}
> > >> >}
> > >> >
> > >> >does not print dataPrvider.length times as what I would want. But how
> > >>can
> > >> >I
> > >> >show a number of text instances being found if it does not go thru
> > >>every
> > >> >row in the datagrid?
> > >>
> > >>
> >
> >
>

Re: Search for text in DataGrid's column

Posted by mark goldin <ma...@gmail.com>.
That means I need to store selection coordinates somewhere in the
dataProvider to reapply selection every time datagrid is scrolled. Is that
correct?


On Fri, Jul 12, 2013 at 8:08 PM, Alex Harui <ah...@adobe.com> wrote:

> The principle of virtual renderers is that they would do their
> highlighting as they get scrolled onto the screen, not all at once.
>
> On 7/12/13 5:11 PM, "mark goldin" <ma...@gmail.com> wrote:
>
> >No, I am not filtering dataprovider. I need to search thru all cells in
> >the
> >column and highlight all instances of search text at once. Can be hundreds
> >of rows.
> >
> >
> >On Fri, Jul 12, 2013 at 5:40 PM, Alex Harui <ah...@adobe.com> wrote:
> >
> >> I'm not sure what are you trying to accomplish.  You could filter the
> >> dataprovider so that only rows with text hits are shown in the DG.  That
> >> code would not be in the renderer.  Otherwise, code in the renderer that
> >> finds text hits in the data item it is responsible for should only be
> >> called for visible rows if you are using virtual layout.
> >>
> >> On 7/12/13 2:18 PM, "mark goldin" <ma...@gmail.com> wrote:
> >>
> >> >I need to come up with a solution for searching a text in a column.
> >>What I
> >> >have now is clearly showing that the following function in the item
> >> >renderer:
> >> >private function
> >> >onTextSearchEvent(event:ApplicantformTextSearchEvent):void
> >> >{
> >> >var _startingPosition:int = Question.text.search(event.textToSearch);
> >> >trace(_startingPosition);
> >> >if (_startingPosition != -1)
> >> >{
> >> >Question.selectRange(_startingPosition, _startingPosition +
> >> >event.textToSearch.length);
> >> >}
> >> >}
> >> >
> >> >does not print dataPrvider.length times as what I would want. But how
> >>can
> >> >I
> >> >show a number of text instances being found if it does not go thru
> >>every
> >> >row in the datagrid?
> >>
> >>
>
>

Re: Search for text in DataGrid's column

Posted by Alex Harui <ah...@adobe.com>.
The principle of virtual renderers is that they would do their
highlighting as they get scrolled onto the screen, not all at once.

On 7/12/13 5:11 PM, "mark goldin" <ma...@gmail.com> wrote:

>No, I am not filtering dataprovider. I need to search thru all cells in
>the
>column and highlight all instances of search text at once. Can be hundreds
>of rows.
>
>
>On Fri, Jul 12, 2013 at 5:40 PM, Alex Harui <ah...@adobe.com> wrote:
>
>> I'm not sure what are you trying to accomplish.  You could filter the
>> dataprovider so that only rows with text hits are shown in the DG.  That
>> code would not be in the renderer.  Otherwise, code in the renderer that
>> finds text hits in the data item it is responsible for should only be
>> called for visible rows if you are using virtual layout.
>>
>> On 7/12/13 2:18 PM, "mark goldin" <ma...@gmail.com> wrote:
>>
>> >I need to come up with a solution for searching a text in a column.
>>What I
>> >have now is clearly showing that the following function in the item
>> >renderer:
>> >private function
>> >onTextSearchEvent(event:ApplicantformTextSearchEvent):void
>> >{
>> >var _startingPosition:int = Question.text.search(event.textToSearch);
>> >trace(_startingPosition);
>> >if (_startingPosition != -1)
>> >{
>> >Question.selectRange(_startingPosition, _startingPosition +
>> >event.textToSearch.length);
>> >}
>> >}
>> >
>> >does not print dataPrvider.length times as what I would want. But how
>>can
>> >I
>> >show a number of text instances being found if it does not go thru
>>every
>> >row in the datagrid?
>>
>>


Re: Search for text in DataGrid's column

Posted by mark goldin <ma...@gmail.com>.
No, I am not filtering dataprovider. I need to search thru all cells in the
column and highlight all instances of search text at once. Can be hundreds
of rows.


On Fri, Jul 12, 2013 at 5:40 PM, Alex Harui <ah...@adobe.com> wrote:

> I'm not sure what are you trying to accomplish.  You could filter the
> dataprovider so that only rows with text hits are shown in the DG.  That
> code would not be in the renderer.  Otherwise, code in the renderer that
> finds text hits in the data item it is responsible for should only be
> called for visible rows if you are using virtual layout.
>
> On 7/12/13 2:18 PM, "mark goldin" <ma...@gmail.com> wrote:
>
> >I need to come up with a solution for searching a text in a column. What I
> >have now is clearly showing that the following function in the item
> >renderer:
> >private function
> >onTextSearchEvent(event:ApplicantformTextSearchEvent):void
> >{
> >var _startingPosition:int = Question.text.search(event.textToSearch);
> >trace(_startingPosition);
> >if (_startingPosition != -1)
> >{
> >Question.selectRange(_startingPosition, _startingPosition +
> >event.textToSearch.length);
> >}
> >}
> >
> >does not print dataPrvider.length times as what I would want. But how can
> >I
> >show a number of text instances being found if it does not go thru every
> >row in the datagrid?
>
>

Re: Search for text in DataGrid's column

Posted by Alex Harui <ah...@adobe.com>.
I'm not sure what are you trying to accomplish.  You could filter the
dataprovider so that only rows with text hits are shown in the DG.  That
code would not be in the renderer.  Otherwise, code in the renderer that
finds text hits in the data item it is responsible for should only be
called for visible rows if you are using virtual layout.

On 7/12/13 2:18 PM, "mark goldin" <ma...@gmail.com> wrote:

>I need to come up with a solution for searching a text in a column. What I
>have now is clearly showing that the following function in the item
>renderer:
>private function 
>onTextSearchEvent(event:ApplicantformTextSearchEvent):void
>{
>var _startingPosition:int = Question.text.search(event.textToSearch);
>trace(_startingPosition);
>if (_startingPosition != -1)
>{
>Question.selectRange(_startingPosition, _startingPosition +
>event.textToSearch.length);
>}
>}
>
>does not print dataPrvider.length times as what I would want. But how can
>I
>show a number of text instances being found if it does not go thru every
>row in the datagrid?