function getRowIndex(target){
var tr = $(target).closest(tr.datagrid-row);
return parseInt(tr.attr("datagrid-row-index"));
}
然后直接在要编辑的行中加入getRowIndex(this)即可。如下
field : 'shipType',
title : getMessage("shipType"),
width : 120,
editor : {
title : getMessage("shipType"),
width : 120,
editor : {
type:"combobox",
options : {
valueField : 'idField',
textField : 'nameField',
panelHeight: 'auto',
url : url,
valueField : 'idField',
textField : 'nameField',
panelHeight: 'auto',
url : url,
onSelect:function(){
var index = getRowIndex(this);//这就是当前combobox下拉框编辑行的索引
}
}
EasyUI Combobox 行索引获取
本文介绍了一个在 EasyUI 中用于获取当前正在编辑的 Combobox 所属行索引的方法。通过 JavaScript 函数 getRowIndex(target),可以轻松地在编辑事件中获取到对应的行索引。
6557





