mercredi 27 avril 2016

How to filter rows in the jqueryGrid based on certain fields?

I have a dropdown menu item on the navigation bar of the jqgrid. Each menu item shows the count of the rows fulfilling certain condition. For example, number of rows that have 'XYZ' property set to true. My problem here is, When i click on this menu item, i would like to show just those rows in the grid. I tried Oleg's solution and looked online, but doesn't help. I tried this too-

var f = { groupOp: "OR", rules: [] };
f.rules.push({ field: 'XYZ', op: 'eq', data: true });
$grid[0] = true;
$.extend($grid[0].p.postData, { filters: JSON.stringify(f) });

I get an error as'stype' is undefined or null reference. basic info of how the grid is setup:

setupGrid: function(grid, pager){
$(mygrid).jqGrid({datatype: 'local', 
                 mtype: 'GET',     
                 url:  "myurl",                       
                 colNames: colNames,
                 colModel: colModel,
                 altRows: false,
                 pager: $(pager),
                 loadonce: true,
                 sortable: true,
                 multiselect: true,
                 viewrecords: true,
                 beforeProcessing: function (data) {
                     setSearchSelect(data, 'ABC');
 }).navGrid(pager, { add: false, edit: false, del: false, search:false }).trigger('reloadGrid', [{ current: true }]);

Please help !

Aucun commentaire:

Enregistrer un commentaire