By default, and for performance reasons, there is no write-detection to
properties.  You use proxy, [bindable] or setters to detect writes.
 
Collections will watch their items for changes if they can, but you are
using dynamic objects and they have to write-detection.   Collections
have an itemUpdated method to allow you to manually notify the
collection that something that could not be watched changed.

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Charles Galpin
Sent: Tuesday, October 02, 2007 11:38 AM
To: [email protected]
Subject: [flexcoders] TileList invalidateList not working



Hopefully an easy one. Please try the simple test case below. Select one
or more items, enter a new label and click "Update". You can optionally
select the checkbox to force an invalidateNow after the update, but
either way, the list doesn't refresh. If you scroll down and up, then
they refresh.

How can I get my TileList to refresh when data changes?

thanks
charles


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " layout="absolute"
applicationComplete="appInit()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
private function appInit():void
{
setData();
}
private function setData():void
{
for (var i:int=0; i<30; i++)
{
dataCollection.addItem({id: i, data: "element " + i});
}
list.invalidateList();
}
private function update():void
{
// save selection
var indices:Array = list.selectedIndices;
for (var i:int=0; i<indices.length; i++)
{
var obj:Object = dataCollection.getItemAt(indices[i]);
obj.data = val.text;
}
list.invalidateList();
if ( doValidateNow.selected )
list.validateNow();
}
]]>
</mx:Script>
<mx:ArrayCollection id="dataCollection" />
<mx:VBox height="400">
<mx:HBox>
<mx:TextInput id="val" />
<mx:Button label="Update" click="update()" />
<mx:CheckBox id="doValidateNow" label="Do a validateNow" />
</mx:HBox>
<mx:TileList id="list" allowMultipleSelection="true" width="250"
height="150" 
change="{ val.text = list.selectedIndices.length > 0 ? '' :
list.selectedItem.data}" 
columnCount="1" labelField="data" dataProvider="{dataCollection}" >
<mx:itemRenderer>
<mx:Component>
<mx:Label text="{data.data}" />
</mx:Component>
</mx:itemRenderer>
</mx:TileList>
</mx:VBox>
</mx:Application>


 

Reply via email to