I m working on MVC 3 with JQGrid. I have created a Custom Search Panel for the search instead of using the 'filterGrid' or 'filterToolbar'. I have a Users Action from which the JQGrid get filled. i created another Json Action which get the filtered result based on the parameter passed by 'Custom Search Panel'. The Jso开发者_运维问答n Action fired by Post method using jquery.
i want to know how to fill the JQGrid with the filtered data ? any ideas?
I would suggest you to reload your grid with the standard method myGrid.trigger('reloadGrid');
and let it fetch the parameters needed by your action.
I would use just one action which receives all your filters:
public ActionResult Fetch(string param1, string param2, int param3, int page, int rows, string search, string sidx, string sord)
{
}
All you have to do is to define your filter in your jqGrid:
postData: {
Param1: function() { return $("#param1").val(); },
Param2: function() { return $("#param2").val(); }
Param3: function() { return $("#param3").val(); }
},
wrapping it in function.
Now, all you have to do is myGrid.trigger('reloadGrid');
and your jqGrid will fetch the data using your newly define filters.
You can read more about it here and here.
As always, Oleg has been great help in that.
精彩评论