I have a jqGrid with json data type and loadOnce: true. I am using the filterToolBar search. It does not return all matches. The grid contains a searchable column called Name and has values “Adkins, Joe” and “Adkinson, Jane”. If I type in search string “Adk”, the only match returned is “Adkins, Joe”.
Here is the grid definition:
function loadmyGrid(dataUrl, selectUrl) {
$("#myGrid").jqGrid({
url: dataUrl + "?r=" + rand(),
datatype: "json",
mtype: 'GET',
rowNum: -1,
loadonce: true,
ignoreCase: true,
scroll: true,
scrollOffset: 0,
gridview: true,
colNames: ["Employee ID", "Name", "User Name", ""],
colModel: [
{ name: "EmployeeID", width: "125", align: "center", sortable: false, resizable: false, title: false, search: false },
{ name: "Name", width: "150", align: "center", sortable: false, resizable: false, title: false },
{ name: "UserName", width: "125", align: "center", sortable: false, resizable: false, title: false, search: false },
{ name: "UserKey", key: true, width: "135", align: "center", sortable: false, resizable: false, title: false, formatter: selectButtonFormatter, search: false},
],
emptyrecords: "Nothing to display",
beforeSelectRow: function () { return false; },
gridComplete: function () {
$("#myGrid").setGridHeight("100%");
$("#myGrid").filterToolbar({searchOnEnter: false, defaultSearch: "cn" })
}
})
Your main error is the usage of
rowNum: -1which is wrong. If you want to prevent local paging of data you should use some large enough value ofrowNum. For examplerowNum: 1000orrowNum: 10000.I recommend you additionally to replace
$("#myGrid")inside of any callback (for examplegridComplete) to$(this). The usage of"?r=" + rand()part of theurlseems me unneeded. The call of$("#myGrid").filterToolbaryou should move outside ofgridCompletebecause it can be called only once.I recommend you additionally to use column templates. It can reduce the code and could make it more manageable and better readable.