Free jqgrid reads data from server using json format. Filter condition is created using jqgrid advanced search, toolbar search or in code.
It is read from GET request query string filters
parameter using
var urlFilters,
namedParameters = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'),
parameters = {},
nameAndValue,
$grid = $("#grid"), i;
for (i = 0; i < namedParameters.length; i += 1) {
nameAndValue = namedParameters[i].split('=');
parameters[nameAndValue[0]] = decodeURIComponent(nameAndValue[1]);
if (nameAndValue[0] === "filters") {
urlFilters= decodeURIComponent(nameAndValue[1]);
}
}
$grid.jqGrid({
postData: { filters: urlFilters }
datatype: "json",
This requires passing encoded filters condition url which is not human readable and editable:
http://localhost//Desktop?filters=%7B%22groupOp%22%3A%22AND%22%2C%22rules%22%3A%5B%7B%22field%22%3A%22Baas%22%2C%22op%22%3A%22eq%22%2C%22data%22%3A%22KLIENT%22%7D%2C%7B%22field%22%3A%22Liigid%22%2C%22op%22%3A%22eq%22%2C%22data%22%3A%22%22%7D%5D%7D
Sometimes users needs to edit browser url directly to create new filter condition ?
How to make url human readable so that it can edited directly ? How to force jqgrid to create advanced and toolbar search conditons in OData or other format which does not need escaped using % when passed in url ?
Free jqgrid has OData plugin.
How to extract OData search filter creation form this plugin and allow jqgrid to serialize search condition in this format and parse it back to show in advanced search filter?
Or is it possible modify current search condion so that "
(%22) is not used in it ?
There are related questions in How to force jqgrid to query data using OData in query string and in How one could use server side sorting and paging with Azure Mobile Services
but I dont know which is best way to implement this.
OData is striclty not required. Maybe some simple change in free jqgrid search condition serializer and deserializer allows to make it human editable in URL. However using OData makes API more standardized.
ASP.NET MVC4 and jquery are used.