【发布时间】:2012-02-10 08:46:03
【问题描述】:
我正在使用两个 Jqgrid,当我双击“主”网格时,我会显示另一个版本的网格。在我正在显示的新网格中,我希望选择/突出显示在“主”网格中选择的行。
ondblClickRow: function (id, rowid) { //function to get value of selected row and show new grid
var ret = $("#grid1").getRowData(id);
loadEditGrid(ret.ID);
function loadEditGrid(id) {
$("#grid1").empty();
jQuery("#grid2").jqGrid({
url: 'test.json',
datatype: "json",
jsonReader: {
root: 'rows',
repeatitems: false,
page: "page",
total: "total",
records: "records",
userData: id,
cell: "",
id: "ID"
},
colNames: ['Item Name', 'Item Id'],
colModel: [{ name: 'ITEM_NAME', index: 'ITEM_NAME', width: 160 },
{ name: 'ID', index: 'ID', width: 80}],
height: "75%"
});
}
},
【问题讨论】:
-
你在“主”网格中使用
multiselect: true吗? -
嗨,奥列格。不,我没有。但我找到了解决方案。 loadComplete: function hightlightRow(selrow) { $('#' + id).addClass('ui-state-highlight'); }
-
但是转到另一个主题。如何获取所选行的页面?
-
因为你使用remote数据源(
datetype: 'json')你可以在服务器上找到需要选择的页面。您可以查看the answer了解更多详情。