Loops 未在循环内刷新ArrayCollection
我有一个for循环,在该循环中我调用了一个远程对象方法,该方法返回一个ArrayCollection。在循环的每次迭代中,ArrayCollection的内容都会发生变化,我将在每次迭代中为该ArrayCollection设置组合框的数据提供程序 但是,只有我的最后一个组合框被绑定到ArrayCollection的最新内容 remote_obj.getYN是一个函数,它将循环中的值作为参数,正如我在上述每次迭代中提到的那样,由于调用此函数,arrayCollection的内容会发生变化 下面是我的代码片段:Loops 未在循环内刷新ArrayCollection,loops,combobox,flex4,arraycollection,Loops,Combobox,Flex4,Arraycollection,我有一个for循环,在该循环中我调用了一个远程对象方法,该方法返回一个ArrayCollection。在循环的每次迭代中,ArrayCollection的内容都会发生变化,我将在每次迭代中为该ArrayCollection设置组合框的数据提供程序 但是,只有我的最后一个组合框被绑定到ArrayCollection的最新内容 remote_obj.getYN是一个函数,它将循环中的值作为参数,正如我在上述每次迭代中提到的那样,由于调用此函数,arrayCollection的内容会发生变化 下面是我
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;
}
有人能告诉我如何解决这个问题吗?
非常感谢您的宝贵帮助。试试这个:
customizedFields_array.refresh(); // refresh the array collection
myDataGrid.invalidateDisplayList();// refresh the datagrid
customizedFields\u阵列只是在一个lsit中返回一个循环。在每次迭代中需要更新的关注数组是_ynarrayCollection。所以你的意思是在设置newCol.filterComboxDataProvider=\u YN之后,我需要刷新数组?尝试刷新它。。。当我遇到自动刷新数组的问题时。刷新总是有效的…我尝试了它…但没有成功…它不起作用。还有其他的帮助吗?
customizedFields_array.refresh(); // refresh the array collection
myDataGrid.invalidateDisplayList();// refresh the datagrid