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

摘要:
如标题所示,在树网格中,根据api中getEditor方法的描述,getEditoroptionsGetspecificeditor,选项包含两个属性:index:thewindex。字段:文件名。varnameEditor=$('#menuTable')。treegrid('getEditor',{id:edi

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

免责声明:文章转载自《EasyUI treegrid 获取编辑状态中某字段的值 [getEditor方法获取不到editor]》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇Windows ServiceIDEA 创建 MAPPER 模板下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

第二百二十八节,jQuery EasyUI,TreeGrid(树形表格)组件

jQuery EasyUI,TreeGrid(树形表格)组件 学习要点: 1.加载方式 2.属性列表 3.事件列表 4.方法列表 本节课重点了解 EasyUI 中 TreeGrid(树形表格)组件的使用方法,这个组件依赖于 DataGrid(数据表格)组件。 一.加载方式 建立一个 JSON 文件 [ { "id": 1,...

EasyUI treegrid 模糊查询、搜索

纯JS完成 treegrid 模糊搜索功能: $("#dataTab").treegrid({ url: '/Organization/GetOrganizationList', //view: DefaultView, fi...