如题,在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方法的说明是错误的,如果我的推测错误或者你有更好的思路或者解决办法,欢迎交流。

 

 

 

相关文章:

  • 2022-12-23
  • 2021-05-23
  • 2022-12-23
  • 2021-12-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-11
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案