First, though I don't think it is a problem, you do not need the sub tags on DGC for the renderer. Just do:
<mx:DataGridColumn headerText="Start Time" itemRenderer="DateTime"> Now, there is a problem with the renderer. It sets its value on creationComplete. This will not work since that only gets called once. The Label.text needs to be updated when the "data" property is set. And it is actually more complicated than that to do it correctly. I advise you find a renderer that is close to what you want and modify it. "...datagrid has some sort of cache..." no, but item renderers are reused. If they are not implemented corrrectly they will not display what you expect. I am not convinced that you really have duplicate data. Verify your actual data by looping over the dataProvider and using trace to display the items. Tracy ________________________________ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of freak182 Sent: Tuesday, January 06, 2009 6:35 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Datagrid duplicate row Hello Tracy, Im experiencing same problem too, added that in my case the data in first row was repeated in next row when i insert data on database and load all data in datagrid.(although the list is < 10) I use remoteobject to save and get all the list of data. When i save the data and get successful save, I simply call the ListEvent, in the result handler, for dispatch and update the arraycollection of data. Im using a renderer to format the display of date. here is the code snippet in datagrid column and renderer itself: <mx:DataGridColumn headerText="Start Time"> <mx:itemRenderer> <mx:Component> <buscomp:DateTime startDate="{data.startTime}"/> </mx:Component> </mx:itemRenderer> </mx:DataGridColumn> ...in the renderer.. <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > " creationComplete="formattingDate();" > <mx:Script> <![CDATA[ [Bindable] public var startDate:Date; [Bindable] public var finalDate:String; public function formattingDate():void { // create a utility that format the date& time to MM/DD/YY hh:mm:ss this.finalDate = dateformat.format(startDate)+' '+startDate.getHours() +':'+startDate.getMinutes(); } ]]> </mx:Script> <mx:DateFormatter id="dateformat" formatString="MMM-DD-YYYY"/> <mx:Label text="{finalDate}" styleName="myText"/> </mx:HBox> ...im just wondering why the data in first got duplicated in next row? does datagrid has some sort of cache? becuase from my previous code (e.g user listng) the datagrid just work fine everytime i save and get the list of data.the data i just save was reflected on the datagrid (no duplication). Thanks a lot. Cheers. -- View this message in context: http://www.nabble.com/Datagrid-duplicate-row-tp21321826p21321826.html <http://www.nabble.com/Datagrid-duplicate-row-tp21321826p21321826.html> Sent from the FlexCoders mailing list archive at Nabble.com.