Reputation: 5238
I'm using two Jqgrids and when I doubleclick on my "main" grid I show another version of the grid. In the new grid I am displaying, I want the row that was selected in the "main" grid to be selected/highlighted.
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%"
});
}
},
Upvotes: 0
Views: 8456
Reputation: 221997
You should use setSelection method to select any row. It's only important the you should do this after the data in the grid are loaded. So you should place the call of setSelection
inside of loadComplete
or inside of gridComplete
callback.
Upvotes: 1