I seem to get a problem when I tried this optimisation, basically say a cell changes its text color to white when selected and back to black when not.
What seems to happen is that it changes to white but not back to black and therefore the cell "dissapears". Doesnt seem to happen all the time and for some reason it seems to happen more if you type something in a cell then click the horizontal scrollbar then click another row. I think this is because UITextField dont really support deferred validation, invalidateDisplay() will not automatically revalidate like it will with UIComponents so any style changes wont be affected until you explicitly call validateNow... --- In [email protected], "Doug McCune" <[EMAIL PROTECTED]> wrote: > > heh, my bad about the comments in that block of code, I copied and pasted > without really reading :) To be diplomatic let's just say I have complex > emotions when it comes to the work that was done on the ADG, and that I > don't in fact hate anyone anywhere in the world. > > On Thu, Sep 4, 2008 at 8:51 AM, Doug McCune <[EMAIL PROTECTED]> wrote: > > > the class has a bunch of other stuff in it too (we needed some further > > display customization), but it's pretty straightforward. The > > updateDisplayOfItemRenderer method was overriden like so: > > > > override protected function > > updateDisplayOfItemRenderer(r:IListItemRenderer):void > > { > > if (r is IInvalidating) > > { > > var ui:IInvalidating = IInvalidating(r); > > ui.invalidateDisplayList(); > > //dear Flex team in India: I hate you. > > // ui.validateNow(); > > } > > } > > > > and then I copied/pasted the entire drawCellItem() method and commented out > > the call to validateNow() that occurs in the lower part of that function. > > Give that a whirl and let me know if it helps with performance. > > > > Doug > > > > > > On Thu, Sep 4, 2008 at 8:46 AM, Adrian Williams <[EMAIL PROTECTED] > > > wrote: > > > >> Hi Doug, > >> > >> This makes sense. It's staggering that the validateNow() is being > >> called basically on every cell.... > >> > >> In hope of avoiding recreating the wheel, would you be willing to > >> share your extended code with me so I can give it a whirl and see if it > >> remedies the problem? > >> > >> Thanks! > >> Adrian > >> > >> Doug McCune wrote: > >> > >> There are a few places within the ADG code where the code loops over > >> every single item renderer and needlessly (or at least excessively) calls > >> validateNow() on each renderer. That forces the renderers to each relayout > >> and draw themselves and does not allow the delayed layout processing that > >> the framework is supposed to allow. > >> > >> See the updateDisplayOfItemRenderer() method in AdvancedDataGridBase and > >> you'll find this function: > >> protected function updateDisplayOfItemRenderer (r:IListItemRenderer):void > >> { > >> if (r is IInvalidating) > >> { > >> var ui:IInvalidating = IInvalidating(r); > >> ui.invalidateDisplayList(); > >> ui.validateNow(); > >> } > >> } > >> > >> that gets run waaay too often. > >> > >> Also see the drawCellItem() method of AdvancedDataGrid, which down at the > >> bottom of the method has this call: > >> > >> if (item is IFlexDisplayObject) > >> { > >> if (item is IInvalidating) > >> { > >> IInvalidating(item).invalidateDisplayList(); > >> IInvalidating(item).validateNow(); > >> } > >> } > >> > >> So basically every time your data grid is redrawing itself it takes way > >> longer than it should. I created an extended version of ADG and overrode > >> those two methods (had to copy/paste most of the drawCellItem method) and I > >> removed the calls to validateNow, seemed to speed things up a lot. > >> > >> Doug > >> > >> On Thu, Sep 4, 2008 at 8:06 AM, Adrian Williams < > >> [EMAIL PROTECTED]> wrote: > >> > >>> All, > >>> > >>> I am seeing some incredible lag while using a couple of simple panels > >>> and a complex ADG. While I love the flexibility and power of Flex/AS and > >>> the ADG, I really need to overcome these performance problems or the > >>> project will sink. > >>> > >>> My ADG has approx. 100 columns with approx. 200 rows, in a grouping > >>> collection that contains approx 30 groups. > >>> > >>> I suspect the lag I am seeing has to do with the redrawing of the > >>> rows. Whenever I scroll or collapse/expand the nodes, it takes between 1/2 > >>> to 1 second for the action to complete. And this isn't even a very large > >>> dataset...we have some that have a few thousand rows. I haven't used any > >>> item rendering (yet) that would slow the speed down, though I have two > >>> columns that have style functions attached. All in all, this is about as > >>> close to display the raw data as I can get. > >>> > >>> I have spent some time with the profiler and performance monitor and > >>> it appears the the code is sound and without memory leaks. I have also gone > >>> thru to refactor poorly designed code and remove unnecessary nestings. > >>> > >>> So my initial questions with this admittedly somewhat vague problem > >>> are: > >>> > >>> 1.) Is there a way to turn off the animations and would doing so > >>> help with the speed? > >>> 2.) Has anyone else faced this same dilemma and how did you overcome > >>> the problems? > >>> > >>> Thanks, > >>> Adrian > >>> > >>> > >> > >> > > > > >

