提示:显现思路是在点击下一页是将选中状态和id,合同金额等数据保存在集合中,同时在刷新时将集合的数据遍历,如果选中状态为true则表示为选中状态。
private var availableArray:ArrayCollection = new ArrayCollection();//保存项目id和available状态
private var dataArray:ArrayCollection = new ArrayCollection();//保存id
private var nextOrPreviousPage:Boolean = false;//是否为翻页操作
public function refreshQueryHandler(e:Event):void{
nextOrPreviousPage = true;
var object:Object;
for(var i:int = 0; i < ArrayCollection(execData.dataProvider).length; i++)
{
if(availableArray.length != 0 && dataArray.length != 0
&& dataArray.getItemIndex(ArrayCollection(execData.dataProvider)[i].id) != -1)
{
availableArray.removeItemAt(dataArray.getItemIndex(ArrayCollection(execData.dataProvider)[i].id));
dataArray.removeItemAt(dataArray.getItemIndex(ArrayCollection(execData.dataProvider)[i].id));
}
//状态为选中,并且集合中没有改数据
if(ArrayCollection(execData.dataProvider)[i].available && !dataArray.contains(ArrayCollection(execData.dataProvider)[i].id))
{
object = new Object();
object.data = ArrayCollection(execData.dataProvider)[i].id;
object.label = ArrayCollection(execData.dataProvider)[i].available;
object.contractMoney = ArrayCollection(execData.dataProvider)[i].contractTotalMoney;
dataArray.addItem(ArrayCollection(execData.dataProvider)[i].id);
availableArray.addItem(object);
}
}
queryControl(mypaging.pBean,viewStack.selectedIndex + 1);
}
private function queryControlResult(event:ResultEvent):void{
var pb:PageBean = event.result as PageBean;
controlArr=pb.list;
execData.dataProvider=controlArr;
dutyPersonData.dataProvider=controlArr;
timeData.dataProvider=controlArr;
longData.dataProvider=controlArr;
projectChangeDG.dataProvider = controlArr;
mypaging.init(pb);
if(nextOrPreviousPage && availableArray.length != 0)
{
for(var m:int = 0; m < availableArray.length; m++)
{
for(var n:int = 0; n < ArrayCollection(execData.dataProvider).length; n++)
{
if(availableArray[m].data == ArrayCollection(execData.dataProvider)[n].id)
{
ArrayCollection(execData.dataProvider)[n].available = availableArray[m].label;
}
}
}
execData.invalidateList();
}
}
DataGrid翻页时保存当前CheckBox选中状态
猜你喜欢
转载自liugang-ok.iteye.com/blog/1138434
今日推荐
周排行