To put it more simply, how do I force an itemRenderer bound to an
image to refresh itself?

 
--- In [email protected], "flexcoder2008" <djohnso...@...> wrote:
>
> I am having trouble getting a datagrid that is bound to an
> XMLListCollection to update properly.  The datagrid uses item
> renderers for a couple of the columns which display a simple colored
> image.  
> 
> 
> <mx:itemRenderer >
>     <mx:Component>
>        <mx:Canvas >
>          <mx:Image source="{data.MyImage}" />
>        </mx:Canvas>
>     </mx:Component>
> </mx:itemRenderer>
> 
> 
> This datagrid's dataProvider is set to bind to an XMLListCollection
> variable which contains XML with one of the nodes being <MyImage>
> 
> 
> This datagrid is a part of a module that gets loaded into a
> TabNavigator control.  When the module initializes I loop through each
> row in the datagrid and check the values of the XML, and depending on
> certain values, I update the content of the <MyImage> node, which in
> turn will change the image source property.
> 
> When the module first loads, everything works fine and the grid
> displays correctly.
> 
> The problem happens when I load a different module into the
> tabNavigator.  In a seperate module I do an update to this same
> XMLListCollection.  (I am using the Cairngorm framework and all my
> shared data is stored in the model. ) When I reload the first module,
> and the initialization logic fires, as I am looping through to do the
> calculations to update the <MyImage> node I can see that everything is
> updating in the XMLListCollection correctly.
> 
> However, when the dataGrid displays, the row that corresponds to the
> updated XML in the XMLListCollection is displaying a blank row, even
> though the underlying values are correct.
> 
> I believe this is a problem with the ItemRenderer not updating itself.
>  How do I force it to invalidate?  I have tried doing a
> dataGrid.dataProvider.refresh() and calling invalidateDisplayList()
> etc. but cannot figure this one out.
> 
> One workaround I discovered is that when I reload the first module
> after updating the underlying XMLListCollection, if I append a new
> empty node to the XML like so:  myXML.* += <empty />    Then the
> updated row displays correctly!
> 
> Has anybody else out there ran into this problem?
>


Reply via email to