arrayCollection content does not is not refreshed in loop
I have a for loop and within the loop I am calling a remote object method that returns an ArrayCollection. At each iteration of the loop the content of the ArrayCollection changes and I am setting the dataProvider of a ComboBox to that ArrayCollection in each iteration.
However, only my last ComboBox is being binded to the latest content of the ArrayCollection.
The remote_obj.getYN is the function that takes as parameter the value from the loop and as such as I mentioned above in each iteration the content of the arrayCollection changes due to this function being called.
Below is my code snippet:
public function myFunc():void{
for (roller = 0; roller < customizedFields_array.length; roller++) {
var newCol:FlexDataGridColumn = new FlexDataGridColumn();
remote_obj.getYN(customizedFields_array.getItemAt( roller).FLD);
newCol.filterComboBoxDataProvider = _YN;
newCol.filterComboBoxLabelField =customizedFields_array.getItemAt(roller).FLD;
newCol.filterComboBoxDataField =customizedFields_array.getItemAt(roller).FLD;
}
cols.push(newCol);
}
myDataGrid.columns = cols;
}
This is the getYN result function in Flex.
public function getYN_result(event:ResultEvent):void{
_YN = event.result as ArrayCollection;
}
Can someone tell me how to go around this issue? Many thanks for your precious help.
|