Am having issues using getLocalRow
along with data property
var $grid;
getGrid = function () {
$grid = $("list");
$grid.jqGrid({
mtype: "POST",
colNames: [],
colModel: [
....
],
pager: "",
loadonce: true,
multiselect: true,
gridComplete: function () {
var data = $(this).getDataIDs();
for(var i=0; i < data.length;i++){
$(this).setSelection(data[i]); // select all rows by default
}
},
loadComplete: function (data) {
},
loadError: function (xhr) {
}
});
return $grid;
};
There are two ways am populating the grid based on 2 scenarios.
In scenario 1, am just hitting server url and returning the data as JSON and populating in the grid. Using this option, when I iterate thru the selected rows and perform getLocalRow am getting the required o/p.
And in scenario 2, I construct a data object and pass it to the same grid. The problem occurs here when I iterate and use getLocalRow in this context am getting false for all the selected rows instead of the row data but works fine with getRowData.
scenario 1 :
$grid.jqGrid("clearGridData");
$grid.jqGrid("setGridParam", {url: '..', datatype: "json"}).trigger("reloadGrid");
scenario 2 :
$grid.jqGrid("clearGridData");
$grid("setGridParam", { data: MyOWNobject}).trigger("reloadGrid");
Accessing getLocalRow :
var sel=[];
for (i = 0; i < $grid.jqGrid("getGridParam").selarrrow.length; i++) {
sel.push($grid.jqGrid("getLocalRow", $grid.jqGrid("getGridParam").selarrrow[i]));
}