Free jqgrid reads remote json data using
$.jgrid.useJSON = true;
$.extend(true, $.jgrid.defaults, {
mtype: 'GET',
url: '@Html.Raw(Url.Action("Entity", "API",))'
} );
search window is defined using
$.extend(true, $.jgrid.search, {
multipleSearch: true,
recreateFilter: true,
closeAfterSearch: true,
overlay: 0,
recreateForm: true
});
If search button is pressed, ugly filters query string parameter is created like
http://localhost:52216/admin/API/Entity/DoklstlG?search=true&nd=1448746804617&rows=20&page=1&sidx=customer&_sord=desc&filters=%7B%22groupOp%22%3A%22AND%22%2C%22rules%22%3A%5B%7B%22field%22%3A%22Klient_nimi%22%2C%22op%22%3A%22cn%22%2C%22data%22%3A%22a%22%7D%5D%7D
How to change that this url, especially filters clause in generated in OData format ? I read jqgrid OData plugin wiki article but havent found such possibility.
I can't suggest you an ready to use solution, but I point you in the direction how you can implement the requirement.
First of all I would recommend you to read the answer? It shows how to use server side sorting and paging of OData. One need to use
$top
,$skip
,$orderby
and$inlinecount
URI parameters which can be set inside ofserializeGridData
. One can implement filtering in the same way. One need to convertfilters
parameter, created by jqGrid, to the object and parse all the rules. One need generate the corresponding$filter
parameter, which support OData (like here and here). It's important to understand that the common implementation is not so easy and it could depend on the exact version of OData implementation which you use.