Search code examples
jqueryasp.net-mvcjqgrid

is there a way to programatically set a filter in jquery jqgrid?


i have a page with a jqgrid on it with filter row at the top. I want to have a link on another page that loads this grid page but with a filter set on one of the columns. is that possible to do from a link or any other workaround people can suggest?


Solution

  • the way i solved this was to pass in the following code:

    var myfilter = { groupOp: "AND", rules: [] };
    myfilter.rules.push({ field: "DataIssuesYN", op: "eq", data: "Y" });
    

    and then in the jqGrid setup, I pass into postData:

      postData: (myfilter) ? { filters: JSON.stringify(myfilter)} : {},