flex - Data Grid not displaying data in array collection -


my data grid displaying stale data, rather real time data available in it's data provider (array collection). i've tried refeshing data in collection, has no effect. below code, see problem?

<mx:accordion/> <fx:script> <![cdata[ private var _griddata:arraycollecton = new arraycollection; [bindable] public function griddata():arraycollection { return _griddata; } public function set griddata(value:arraycollection):void { _griddata = value; } public function loadgriddata():void {  // imgcollection data returned server var tempcollection:arraycollection = new arraycollection();  (var i:int = 0; < imgcollection.length; i++)             {                 var img:object = new object();                 img.id = imgcollection.getitemat(i).imgid;                 img.url = "http://..." + imgcollection.getitemat(i).imgid;                 img.caption = (imgcollection.getitemat(i).imgcaption == null) ? "": imgcollection.getitemat(i).imgcaption;                 img.group = images;                 tempcollection.additem(new objectproxy(img));             } griddata = tempcollection;  <!-- use http service data , save in grid data array collection, run on accordion create completion , whenever data added or removed array collection --> } ]]> </fx:script> <!-- note: there cyclic binding between data grid , griddata array collection --> <fx:binding source="dg.dataprovider arraycollection" destination="griddata"/> ... ... <s:navigatorcontent> <s:panel> <mx:datagrid dataprovider="{griddata}" ...> ... ... </mx:datagrid> </s:panel> </s:navigatorcontent> 

update: tried suggestions mentioned below, however, not resolve issue. data grid has custom item renderers, problem?

<?xml version="1.0" encoding="utf-8"?> <s:mxdatagriditemrenderer xmlns:fx="http://ns.adobe.com/mxml/2009"                            xmlns:s="library://ns.adobe.com/flex/spark"                            xmlns:mx="library://ns.adobe.com/flex/mx"                            focusenabled="true">     <mx:image id="image" source="{data.url}" height="65" maintainaspectratio="true" scalecontent="true"/> </s:mxdatagriditemrenderer> 

you don't need "cyclical" binding, because in datagrid not change collection, change items. collection stays intact. dataprovider of datagrid , _griddata point same collection.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -