I’ve implemented a JQGrid table with loadonce:true like this :
jQuery("#list").jqGrid({
datatype: 'jsonstring',
datastr : maVarJSON,
colNames:['AA','BB', 'CC','DD','EE','FF'],
colModel :[
{name:'invid', index:'invid', align:'center'},
{name:'invdate', index:'invdate'},
{name:'amount', index:'amount', align:'right'},
{name:'tax', index:'tax', align:'right'},
{name:'total', index:'total', align:'right'},
{name:'note', index:'note'}
],
pager: jQuery('#pager'),
rowNum: 50,
rowList: [50, 100],
caption: '',
height: 470,
width: 1000,
loadonce: true
});
jQuery("#list").jqGrid('filterToolbar',{afterSearch: function(){
var rowsFiltered = jQuery("#list").getRowData();
}});
My problem is :
I have 500 rows in maVarJSON. I see 50 rows and 10 pages.
I decide to filter my column AA. Only 100 rows accept this filter. So, I see 50 rows and 2 pages.
I would get the 100 rows data. (The method jQuery("#list").getRowData() give me only the 50 first rows data.)
Thanks
The method
getRowDataget the data from the current page only. If you need get all the grid data you can usegetGridParamto get'data'parameters and get all grid data. I don’t really understand what you want to do with the data inside ofafterSearchcallback. The goal offilterToolbarto display the data for the user and not to get you JavaScript interface to filter some JavaScript data.By the way you can remove
caption: ''option which is default, removeloadonce: truewhich will be ignored for local data inclusivedatatype: 'jsonstring'and replacepager: jQuery('#pager')option topager: '#pager'. If you would usepager: jQuery('#pager')jqGrid will have to convert it topager: '#pager'itself internally.