ext.net gridlist选择内部元素时自动选择所在行

时间:2021-12-05 18:02:08
function changeSelection(id) {
var index = 0;
for (var i = 0; i < mcp_liststore.data.length; i++) {
if (mcp_liststore.data.get(i).id == id) {
index = i;
break;
}
}
for (var i = 0; i < mcp_gridlist.store.getCount(); i++) {
mcp_gridlist.getSelectionModel().deselectRow(i);
}
mcp_gridlist.getSelectionModel().selectRow(index, true);
};

构建html时,给内部元素传入id即可,需要的地方调用
onclick='changeSelection("+p_record.data.ID+")'