Flex uses events to cause the UI to update in response to changes in the
underlying data.

 

If you use the correct API to update the data, then Flex will dispatch
the necessary events.  Common API methods include setItemAt(),
addItem(), ... using the API is the best practice.

 

If you manually update a dataProvider item, say by assigning a value to
a property, then the necessary events are not dispatched.  The
collection.itemUpdated() method can be used in this case.

 

See the recent thread "Slow datagrid updates" for example code.

 

Tracy

 

________________________________

From: [email protected] [mailto:[email protected]] On
Behalf Of Guy Morton
Sent: Tuesday, January 06, 2009 7:49 AM
To: [email protected]
Subject: [flexcoders] DataGrids, itemRenderers and dataChange events

 

Hello

I hope someone here will be good enough to help me. I have a DataGrid, 
and a custom itemRenderer that shows an image depending on the value 
of the data in that cell. The trouble is that I am updating the value 
of the data in that cell when I do an update to one of the other cells 
in that row (via a different itemEditor, triggered by the itemEditEnd 
event), but that change is not being shown in the cell in question 
unless it gets redrawn by some other means, eg scrolling the field out 
of view and back in will show the new data, as will rearranging the 
columns (presumably because both of these actions force a redraw of 
the data in the cell in question).

Is there a way to force the updated value to trigger a redraw in the 
cell? My renderer is set up to catch the dataChange event but that 
doesn't seem to get dispatched unless one of the aforementioned things 
is done to force it.

Am I missing something here? Or is this a flaw in Flex?

Guy

 

Reply via email to