展会信息港展会大全

datagrid不可编辑行有关问题的控制方法
来源:互联网   发布日期:2016-01-19 12:45:26   浏览:2910次  

导读:datagrid不可编辑行一个更简单的办法,editable=true,然后直接把itemEditBegin给停掉阻止 createItemEditor的调用------解决方案--------------------写renderer呗,renderer里可以拿到你点的这个cell是第几行 ...

datagrid不可编辑行一个更简单的办法,editable= true ,然后直接把itemEditBegin给停掉阻止 createItemEditor的调用

------解决方案--------------------

写renderer呗,renderer里可以拿到你点的这个cell是第几行和第几列,根据行列改变DataGrid的editable属性,给你一个思路:

1.renderer里监听点击事件;

2.事件处理函数中从listDatadata取出行列index,进行判断(哪一行可编辑这个变量可以通过创建renderer的时候用 properties传到renderer中);

3.if(true),把listData.owner(或parentDocuemnt)的editable属性设为true,然后将光标放到点击的这个cell上(设editedItemPosition属性,怎么用自己去查);

4.监听DataGrid的itemEditEnd事件,事件处理函数中把editable函数在设为false

------解决方案--------------------(已验证)

想到一个更简单的办法,editable= true ,然后直接把itemEditBegin给停掉阻止createItemEditor的调用,

听DataGrid的itemEditBegin事件

代码如下:

private function onItemEditBegin(event:DataGridEvent):void

{

if(event.rowIndex == 0)//如果是第一行,则不让编辑

{

event.stopImmediatePropagation();

}

}

赞助本站

人工智能实验室

相关热词: datagrid 控制方法

AiLab云推荐
推荐内容
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港