You are sure you are using the Collection API exclusively?  And not
doing any direct assignments of values to item porperties?  For example:

var oCurrentItem:MyItem = myAC.getItemAt(0);

oCurrentItem.myProperty = "myValue";    //direct assignment does not
cause UI to update

 

If you are doing any of the above, then you need to call itemUpdated()
after the assignment.

 

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Tim Hoff
Sent: Saturday, October 18, 2008 5:14 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Crazy DataGrid display of XMLListCollection

 

Hi,

If the dataProvider is [Bindable], the DataGrid should reflect the
changes to the dataProvider; when the dataProvider is changed.  For the
itemRenderer question, here's one way to update the display list:

override public function set data(value:Object):void
{ 
    if (value != null) 
    {
        super.data = value; 
        
       // do something conditional

        super.invalidateDisplayList();
    } 
}

However, since there isn't any conditional changes to the itemRenderer,
this would be unnecessary.

-TH

--- In flexcoders@yahoogroups.com, "edlueze" <[EMAIL PROTECTED]> wrote:
>
> I am trying to update the display of an XMLListCollection in a
> 2-column DataGrid but I am getting crazy results.
> 
> The XMLListCollection contains following data:
> 
> <item><order>1</order><content>AAA</content></item>
> <item><order>2</order><content>BBB</content></item>
> <item><order>3</order><content>CCC</content></item>
> <item><order>4</order><content>DDD</content></item>
> 
> I am providing the user with two buttons to raise or lower the content
> within the XMLListCollection. For example, if the user selects the
> 'CCC' row and clicks the 'RaiseButton' then the XMLListCollection will
> change to:
> 
> <item><order>1</order><content>AAA</content></item>
> <item><order>2</order><content>CCC</content></item>
> <item><order>3</order><content>BBB</content></item>
> <item><order>4</order><content>DDD</content></item>
> 
> Note that the order field is recalculated to always be increasing -
> and the content field is reordered.
> 
> I've created a new Class that extends XMLListCollection with two new
> functions: 'raiseItem' and 'lowerItem'. These new functions take
> copies of the XML for the 'BBB' row and the 'CCC' row, and then rely
> upon the XMLListCollection function 'setItemAt' to do the reordering.
> The underlying XMLList is then sent to a server for processing. This
> seems to work perfectly and traces of the XMLListCollection always
> seem correct.
> 
> Unfortunately the XMLListCollection display in the DataGrid fails to
> keep up with changes in the underlying data.
> 
> I've tried lots of combinations of 'invalidateDisplayList',
> 'invalidateList', 'validateNow', 'refresh' and 'sort'. I've tried
> nullifying and resetting the 'dataProvider'. And I've tried copying
> over the entire list XMLListCollection one element at a time into a
> new display version of the XMLListCollection. Often I get duplicate
> display rows, but sometimes I get the entire list displayed in
reverse?!
> 
> I suspect the itemRenderers aren't getting the message that they
> should be refreshing (one column uses the 'labelFunction' and the
> other has a not-too-complicated custom itemRenderer).
> 
> How would I go about invalidating the display of *each* itemRenderer
> individually? What else should I try??
> 
> Thanks!
>

 

Reply via email to