Hi everyone,
I'm trying to get my custom beforeSearch function working again with jqGrid 3.6 beta.
At some point, I need to be able to clear my previous search data and add custom data instead while I'm using the filterToolbar. There are two options I have:
Option 1:
var myGrid = $('#myGrid')[0];
myGrid.triggerToolbar();
This will trigger my beforeSearch function where I do something like this:
$('#myGrid').jqGrid('setGridParam',{ postData:{ a: 'getAllUnits', group_id: dtnode.data.key }, search:true });
The triggerToolbar function itself takes care of clearing old search data. The problem with this though, is that I manually add the group_id to the postdata instead of using the filterToolbar field for it and the triggerToolbar function does a little too much clearing now since it doesn't see any values in any of the toolbar fields and it will set my search value back to 'false' which is kinda in contradiction to the statement at the wiki:
“When this method is called a search is performed, the search parameter in grid becomes true and ajax call is made to the server”
The search paramater will only become true IF you actually have a value in any of the search fields…
Option 2:
var myGrid = $('#myGrid')[0];
myGrid.clearToolbar();
$('#myGrid').jqGrid('setGridParam',{ postData:{ a: 'getAllUnits', group_id: dtnode.data.key }, search:true });
$('#myGrid').trigger('reloadGrid');
Which of course will reload my grid twice which is not wat I want to do.
I'm not sure what exactly changed in the setGridParam or trigger reload function, because with version 3.5 I was able to do it like this:
$('#myGrid').jqGrid('setGridParam',{ postData:{ a: 'getAllUnits', group_id: dtnode.data.key }, search:true });
$('#myGrid').trigger('reloadGrid');
And no old search values would get posted.
So my question here is, how can I reload my grid with custom postvalues without posting previous search values with it? Or how can I clear the old search values without reloading my grid at the same time?
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top