DataGrid控制行的多选

一、获取选择行

可以通过以下属性进行选择项的获取
this.dataGrid.selectedIndex
this.dataGrid.selectedIndices
this.dataGrid.selectedItem
this.dataGrid.selectedItems

二、程序设置选择行

对于单行的选择可以通过下面进行选择
this.dataGrid.selectedIndex=iIndex;
this.dataGrid.selectedItem=item;

对于多选项则不能直接通过
this.dataGrid.selectedIndices.push(iIndex);
this.dataGrid.selectedItems.push(item);
这样做行不能选中

应该通过定义Indices或Items数组,并直接设置才可以实现多选。
如下:

var selectedIndices:Array=new Array();
for(var i:int=0;i<this._currentPageData.length;i++)
{
 if(this._dataProviderSelection.contains(this._currentPageData[i]))
 {
  selectedIndices.push(i);
 }
}
this.dataGrid.selectedIndices=selectedIndices;

注意:通过程序设置选择,不会触发itemClick事件。

 

转自:http://gis-conquer.blog.sohu.com/159939467.html

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值