Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4062078
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:33:12+00:00 2026-05-20T15:33:12+00:00

i see how in this code, you can preset postdata filters by have this

  • 0

i see how in this code, you can preset postdata filters by have this in your javascript.

postData: {
   filters:'{"groupOp":"AND","rules":['+
    '{"field":"invdate","op":"gt","data":"2007-09-06"},'+
    '{"field":"invdate","op":"lt","data":"2007-10-04"},'+
    '{"field":"name","op":"bw","data":"test"}]}'
}

is there any API that allows you to build this up. Something like:

jqgrid("#grid").addPostDataFilters("AND");
jqgrid("#grid").addFilteritem("field", "cn", "value");
jqgrid("#grid").addFilteritem("field1", "eq", "value2");

to help generate to top postdata filter code ??

i tried this but it doesn’t seem to work:

.jqGrid("setGridParam", { editurl: "/Project/UpdateMe",
         ondblClickRow: function (rowid) {
             editProject(rowid); // window.location.href="/Project/Detail/"+rowid;
         }
});

var grid = $("#grid");
var f = { groupOp: "AND", rules: [] };
f.rules.push({ field: "Name", op: "cn", data: "volat" });
grid.p.search = f.rules.length > 0;
$.extend(grid.p.postData, { filters: JSON.stringify(f) });

Update:

I have this working now (thanks to Oleg) but ifor some reason the Find button somethng comes up with blank (even thought i do have an advanced filter set) i have added a picture

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T15:33:12+00:00Added an answer on May 20, 2026 at 3:33 pm

    The filter

    filters:'{"groupOp":"AND","rules":[{"field":"invdate","op":"gt","data":"2007-09-06"},{"field":"invdate","op":"lt","data":"2007-10-04"},{"field":"name","op":"bw","data":"test"}]}'
    

    which you included in the question is serialized to JSON version of the object

    var myfilter = {
        groupOp: "AND",
        rules: [
            { field: "invdate", op: "gt", data: "2007-09-06" },
            { field: "invdate", op: "lt", data: "2007-10-04" },
            { field: "name",    op: "bw", data: "test"       }
        ]
    }
    

    which can be easy constructed dynamically:

    // addPostDataFilters("AND");
    var myfilter = { groupOp: "AND", rules: []};
    
    // addFilteritem("invdate", "gt", "2007-09-06");
    myfilter.rules.push({field:"invdate",op:"gt",data:"2007-09-06"});
    
    // addFilteritem("invdate", "lt", "2007-10-04");
    myfilter.rules.push({field:"invdate",op:"lt",data:"2007-10-04"});
    
    // addFilteritem("name", "bw", "test");
    myfilter.rules.push({field:"name",op:"bw",data:"test"});
    
    // generate to top postdata filter code
    var grid = $("#list");
    grid.jqGrid({
        // all prarameters which you need
        search:true, // if you want to force the searching
        postData: { filters: JSON.stringify(myfilter)}
    });
    

    if the grid already exist you want to reload the grid with the settings you can use

    grid[0].p.search = myfilter.rules.length>0;
    $.extend(grid[0].p.postData,{filters:JSON.stringify(myfilter)});
    grid.trigger("reloadGrid",[{page:1}]);
    

    instead. The function JSON.stringify is supported by the most web browsers natively, but to be sure
    you should include json2.js on your page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code below. As you can see I am passing two variables
Can't seem to figure this out, see code below. Trying to make a GET
I have been looking over this code for the past hour, I cant see
See this code: var jsonString = '{id:714341252076979033,type:FUZZY}'; var jsonParsed = JSON.parse(jsonString); console.log(jsonString, jsonParsed); When
In a webservice I see this code: <WebMethod()> _ Public Function dosomething() As Boolean
i'm playing with MEF and in the example i see this code ( i
Please see this piece of code: #include<stdio.h> #include<string.h> #include<stdlib.h> int main() { int i
I've see this sort of thing in Java code quite often... try { fileStream.close();
it's common to see something like this in code, hopefully only during development: //XXX:
Why do I not see the spinner image when I run this code? However

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.