I am using jqgrid advanced search in my project. Everything works fine. Now I have to display a default search condition on click of search button. Please tell me how can I achieve this. I have tried the below code in beforeShowSearch
var postdata =
{
filters: '{"groupOp":"AND","rules":[' +
'{"field":"invdate","op":"gt","data":"2007-09-06"}]}'
};
grid.jqGrid('setGridParam', { search: true, postData: postdata });
It dint work.
If you need to reset searching filters on every opening of advanced searching dialog you can’t use
beforeShowSearchcallback in the case because thepostData.filterswill be read by searching dialog before calling ofbeforeShowSearch. What you can do is adding of your custom Searching button with respect of navButtonAdd which looks exactly like the original search button and usesearch: falseoption of navGrid to have no standard button. Inside ofonClickButtonyou can reset thefiltersproperty ofpostDatabefore calling of searchGrid.Alternatively you can reset the value of
postData.filtersinside ofloadCompletecallback and userecreateFilter: trueoption of advanced searching to force creating of new filter on every opening of searching dialog.The demo demonstrate the last approach. It defines first the variable
and use
loadCompletefor resetting the filter