datagrid里边的combobox获取当前row的索引(总结于EasyUI中文社区群讨论)

 datagrid里边的combobox获取当前row的索引,举个例子:

10个行,同时打开编辑状态。
现在,点开第4行的a列的combobox,请问如何在combobox的select里得到 所在的row 是 第4行?

方案一:  var selections = $("#a").datagrid('getSelections');

 方案一被否,编辑状态下获取不了selections


正确的做法是:

1.在beginEdit的时候,得到combobox这个editor,为它增加(其实是重写)onSelect;

2.通过 $(editor.target).parents("tr.datagrid-row").attr("datagrid-row-index")来得到所在数据行的索引 

 全靠硬生生的html解析,无它 

猜你喜欢

转载自blog.csdn.net/bruceoyqq/article/details/76618618
今日推荐