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 <[email protected]> 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 <[email protected]> > 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 <[email protected]> > > 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 <[email protected]> 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" <[email protected]> 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 <[email protected]> > 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" <[email protected]> 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? > > > > >> > > > > >> > > > > > > > > > > > > > >
