[flexcoders] Re: itemRenderer data question (recycling)

2009-01-28 Thread Amy
--- In flexcoders@yahoogroups.com, nwebb neilw...@... wrote:

 Ah right - wasn't aware that repeaters didn't recycle - thanks.

Repeaters have a property that allows you to tell them to recycle.



Re: [flexcoders] Re: itemRenderer data question (recycling)

2009-01-23 Thread nwebb
Yes, doing that already - thanks :)

On Thu, Jan 22, 2009 at 4:45 PM, ross_w_henderson pub...@rwebdev.comwrote:

   Hi.

 Are you updating super.data in your set data function?

 If you aren't, give this a try:

 public override function set data(value:Object):void
 {
 super.data = value;
 if(value == null) return;

 .
 }

  



Re: [flexcoders] Re: itemRenderer data question (recycling)

2009-01-23 Thread nwebb
Nice idea - thanks :)


 Could you use a static Dictionary on the itemRenderer class, with the
 key being the UID?

 That way you can get the old% value regardless of whether you're in
 the same renderer instance?

  



[flexcoders] Re: itemRenderer data question (recycling)

2009-01-22 Thread ross_w_henderson
Hi.

Are you updating super.data in your set data function?

If you aren't, give this a try:

public override function set data(value:Object):void
{
super.data = value;
if(value == null) return;

.
}



[flexcoders] Re: itemRenderer data question (recycling)

2009-01-22 Thread tonyjobrien
--- In flexcoders@yahoogroups.com, nwebb neilw...@... wrote:

 Hi,
 
 I have 2 List components on a page.
 The one on the left displays the names of some  bundles - e.g.
*Bundle 1*
 
 The one on the right displays the items in the selected bundle, plus a
 percentage value - e.g. *item1 - 10%* *item2 - 55%* 
*item3 -
 61%*
 
 The items are the same for all bundles, but their percentages may
change as
 the user selects different bundles. If that happens I want to
highlight that
 itemRenderer. (eg when the percentage changes, highlight renderer)
 
 
 I looked at a similar example from Alex Harui - he compares a DataGrid's
 listData.UID to the previous UID (stored as a property on the
renderer). If
 they match, he knows he has the same item and changes that value.
 
 I have implemented IDropInListItemRenderer (so I have access to the
UID) but
 the renderer-recycling of the List means that even when the UID's
match, the
 oldPercent value I stored doesn't actually match up to item being
 displayed - in other words, the renderer which previously displayed
*item1
 - 10%* may now be displaying *item3 - 61%* , so the percentage HAS
 changed, but that's because it's displaying a different item!
 
 Is my only option to send both the new% and old% in via the
dataprovider, or
 is there another way to get around this issue?
 
 Cheers


Could you use a static Dictionary on the itemRenderer class, with the
key being the UID?

That way you can get the old% value regardless of whether you're in
the same renderer instance?