Hello! I have DataGrid and DataProvider. I want to make function that will be add content of first two columns to third and also to dataProvider. For first row of DataGrid it works, but when user fills second row, Column3 in initDG of this row became empty. Can you help me? Thanx in advance and sorry for my bad English.
[COLOR=#b1b100]**var**[/COLOR] initDG:ArrayCollection = [COLOR=#b1b100]**new**[/COLOR] ArrayCollection[COLOR=#66cc66]([/COLOR][COLOR=#66cc66][[/COLOR] [COLOR=#66cc66]
{[/COLOR]Column1:[COLOR=#ff0000]'x11'[/COLOR], Column2:[COLOR=#ff0000]'x12'[/COLOR], Column3:[COLOR=#ff0000]'x13'[/COLOR][COLOR=#66cc66]}[/COLOR],
[COLOR=#66cc66]{[/COLOR]Column1:[COLOR=#ff0000]'x21'[/COLOR], Column2:[COLOR=#ff0000]'x22'[/COLOR], Column3:[COLOR=#ff0000]'x23'[/COLOR][COLOR=#66cc66]},[/COLOR]
[COLOR=#66cc66]{[/COLOR]Column1:[COLOR=#ff0000]'x31'[/COLOR], Column2:[COLOR=#ff0000]'x32'[/COLOR], Column3:[COLOR=#ff0000]'x33'[/COLOR][COLOR=#66cc66]}[/COLOR] [COLOR=#66cc66]][/COLOR][COLOR=#66cc66])[/COLOR];
private function func3(item:Object, column:DataGridColumn):String
var string3:String=item.Column1+item.Column2;
initDG[myGrid.SelectedIndex]=string3;
return string3;
}
<mx:DataGrid id="myGrid" dataProvider="{initDG}" editable="true" selectable="true">
<mx:columns>
<mx:DataGridColumn dataField="Column1"/>
<mx:DataGridColumn dataField="Column2"/>
<mx:DataGridColumn dataField="Column3" labelFunction="func3"/>
</mx:columns>
</mx:DataGrid>