I've been playing with jqGrid for quite a long time now but never gone deeper into details about performance.
I don't use the built-in jqGrid search form cause I prefer to have my own toolbar where the user inputs some data he/she wants to filter.
I've always wrapped my grid in a function:
$(document).ready(function () {
var myGrid = jQuery("#MyGrid");
$("#cmdSearch").bind('click', function (e) {
myGrid.GridUnload();
LoadMyGrid($("#Filter1").val(), $("#Filter2").val())
});
function LoadMyGrid(param1, param2) {
myGrid.jqGrid({
url: 'myUrl',
postData: { Param1: param1, Param2: param2 },
datatype: 'json',
mtype: 'POST',
colNames: ['Column1', 'Column2'],
colModel: [
{ name: 'colum1', index: 'colum1', sortable: true, width: 100 },
{ name: 'colum2', index: 'colum2', sortable: true, width: 100 }
],
pager: $('#MyPager'),
rowList: [10, 50, 100],
rowNum: 10,
viewrecords: false,
shrinkToFit: false,
rownumbers: true,
hidegrid: false,
emptyrecords: "No records."
});
}
});
and unloaded it (GridUnload
) before recreating it. I was wondering if this is the best way to do it or there might be some performance/memory issues?