EasyUI treegrid 获取编辑状态中某字段的值 [getEditor方法获取不到editor]

如题,在treegrid里,按照api里getEditor方法的说明,

getEditor
options
Get the specified editor, the options contains two properties:
index: the row index.
field: the field name.

var nameEditor=$('#menuTable').treegrid('getEditor', {id:editingId,field:"name"});

 这样应该可以取到editor对象,但是测试发现只能获取到nameEditor=null,测试多次,很是恼火。

后来比较了下datagrid里的getEditor方法,

getEditor
param Get the specified editor, the param contains two properties:
id: the row node id.
field: the field name.

尝试着把上面treegrid getEditor中的id参数换成了index,值仍然使用id的值,果然,可以获取到editor对象了,再对此对象进行了一番属性遍历之后,终于找到了问题的解决办法,如下:

var nameEditor=$('#menuTable').treegrid('getEditor', {index:editingId,field:"name"});
var name=nameEditor.target.val();

由此,我敢保证官网api中关于treegrid的getEditor方法的说明是错误的,如果我的推测错误或者你有更好的思路或者解决办法,欢迎交流。

 

 

 

转载于:https://www.cnblogs.com/youryida/p/3218119.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值