Alex, "recycle" means that in a list based component, item renderer
instances are only created for the visible rows, plus a few more for
buffering.  When the underlying dataProvider of the list is changed, or
sorted, or really touched in any most any way, or when the list is
scrolled,  the framework re-sets the "data" property of each renderer,
passing in the dataProvider item. (and calls invalidateProperties())

 

So any visual aspect of the renderer that depends on the underlying data
item must be re-calculated and re-displayed whenever that 'data"
property changes. (really a bit later, see Alex H's blog )

 

You can not do it in the initialize, or creationComplete events, because
those get called once, when the component first instantiates.

 

I can't tell from your posting how you are handling this.

 

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Alex
Sent: Thursday, December 27, 2007 2:45 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: tileList displaying items order other than
that represented by dataProvider

 

interestingly I find that any if the itemRenderer's methods to
retreive data as part of drawing the items is only called the 1st time
the item is rendered. Switching views, even resorting in grid view and
re-displaying the view stacks' tile view (where the renderer is
drawing the icon representation of the tiled items) does NOT result in
the item renderer being called on any of the subsequent displays of
the tile/icon view. 

In a reply to the other response to my initial posting I suggested
that I had 2 instances of this viewstack in my application, an 'old'
one and a new one in which I'm attempting to component-ize the
viewstack with 'N' views of the same dataset. The old implementation
works, the new doesn't. In both implementations the above behavior of
only calling the itemRenderer the 1st time each tile is rendered is
observed so that in and of itself is not an issue apparently.

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Alex" <[EMAIL PROTECTED]> wrote:
>
> Thanks for the tip
> 
> From your blog entry I read "Recycle" to mean that I need an else
clause wherever I have 
> an if to ensure that the 'unhandled' condition is handled and some
value for an attribute is 
> always set.
> 
> The renderer I have coded either always returns a value from its
methods (i.e., no 
> conditional statements) or where there IS an if clause there also
needs to be an else to 
> ensure that a value for the desired attribute is always provided.
> 
> If my interpretation of 'recycle' is not correct please let me know.
> 
> Thanks!
> Alex
> 
> --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> , "Alex Harui" <aharui@> wrote:
> >
> > Are you using a custom renderer? Sounds like it doesn't know how
to be
> > recycled. More about renderer recycling on my blog
> > (blogs.adobe.com/aharui)
> > 
> > ________________________________
> > 
> > From: flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> 
[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> > Behalf Of Alex
> > Sent: Friday, December 21, 2007 2:11 PM
> > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>

> > Subject: [flexcoders] tileList displaying items order other than
that
> > represented by dataProvider
> > 
> > 
> > 
> > I have a problem with a viewStack that has 2 views, a dataGrid and a
> > tileList view both of which which share a common dataProvider.
> > 
> > - The tileList uses an itemRenderer to draw an icon/name for each
item.
> > - The datagrid affords the ability to sort the displayed items by
> > clicking on the column headers.
> > 
> > The initial display of both views is as expected, the sort order in
> > the tileList view matches that of the items in the dataGrid view.
> > 
> > A "trace" of the data items in the dataProvider invoked whenever I
> > switch between views [via trace(datagrid.dataProvider) and
> > trace(tilelist.dataProvider)] both show the items in the list in the
> > order expected regardless of how many times I switch views back and
> > forth.
> > 
> > The items (a ListCollectionView of items of type "Foo") listed by
the
> > trace as expected reflect the format of the "toString" function in
the
> > Foo class.
> > 
> > Now the problem...
> > 
> > 1) When I click a header in the dataGrid view to re-sort the data
> > subsequent trace output of the dataProvider's list of objects
changes
> > to another format:
> > 
> > (Array)#0
> > [0] (com.emc.sspg.cem.data::Foo)#1
> > attribute1_name = value1
> > attribute2_name = value2
> > [1] (com.emc.sspg.cem.data::Foo)#1
> > 
> > etc.
> > 
> > I'm not sure why this happens..
> > 
> > 2) The array elements in the trace output are reordered to reflect
the
> > expected sort order as displayed in the dataGrid view AND the
tileList
> > view BUT the order of the actual icons drawn in the tileList view
does
> > not match the order of the items traced. (In fact I've yet to be
able
> > to discern what order they are now drawn in, its not the original
> > "pre-sorted" order either.)
> > 
> > ---------
> > 
> > Another subtlety my trace statements have pointed out is that only
the
> > 1st time the icon view is drawn do the item renderers get called to
> > actually get the icon and name to display.
> > 
> > Solution-wise, while not a great solution I've tried to insert
various
> > functions to invalidate the drawing such that subsequent views of
the
> > icon view would re-call the renderers to prove to me that they are
> > being drawn in the order that I'm seeing them left-to-right,
> > top-to-bottom in the tileList but none of the following cause that
to
> > occur.
> > 
> > tilelist.invalidateDisplayList();
> > tilelist.invalidateList();
> > tilelist.invalidateProperties();
> > tilelist.dataProvider.refresh();
> > 
> > Any thoughts regarding this would be appreciated.
> > 
> > Thanks
> >
>

 

Reply via email to