I am facing issue while loaidng the data in JQGrid at a later stage in place of at the time of ceating grid. I am using filter toolbar for search.
following is the code I am using:
Creating Grid
jQuery("#list").jqGrid({ datatype: 'local', colNames: [my col names], colModel: [my col model], jsonReader: { root: "rows", page: "page", total: "total", //records: "records", repeatitems: false }, height: 300, viewrecords: true, gridComplete: this.onGridComplete, ondblClickRow: this.rowDblClick, onSelectRow: this.selectRow, headertitles: false, loadtext: "Loading...", sortable: true, altRows: true, loadonce: true, rowNum: 100, pager: '#pager', root: "rows", rowList: [100, 200, 300], pagination: true, ignoreCase: true })
Load data at later stage
if(gridDataStr != "none") // gridDatStr has data { grid.initialize(); // create the grid var myjsongrid = JSON.parse(gridDataStr); grid.table[0].addJSONData(myjsongrid); grid.table.jqGrid('setGridParam',{datatype:'json', data:myjsongrid}).trigger('reloadGrid'); if (myjsongrid["rows"].length > 1) { grid.table.filterToolbar({ stringResult: true, searchOnEnter: false }); } }
However if I load the same data at the time of creating the grid with datatype:json and using some valid url, searching is working well.
Any suggestions?