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 8064909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:30:14+00:00 2026-06-05T11:30:14+00:00

I need help to do range select on jqgrid data using the filter toolbar

  • 0

I need help to do range select on jqgrid data using the filter toolbar drop down – I checked the sopt options it only has –

['equal','not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain']

and I am not able to find any clue on how to do range with this on the toolbar. I have a drop down that has values like "All", "1-4", "5-9" on my filter toolbar and when I select say '1-4' I want the grid to populate all rows that fall in that range. I looked at a bunch of examples for filter from stackoverflow and trirand itself but they all seem to be for the search box.
I am grateful for any help to achieve this, Thanks.

  • 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-06-05T11:30:16+00:00Added an answer on June 5, 2026 at 11:30 am

    I was able to achieve this filter by range based on sample multi-word sample- http://www.ok-soft-gmbh.com/jqGrid/MultiwordSearchingToolbar.htm. Most of the code is from above mentioned sample with minor changes. Modified baseed on feedback from Oleg to make it as le and ge.

        modifySearchingFilter = function (separator) {
                var i, rules, rule, parts, group, str;
                var filters = $.parseJSON(this.p.postData.filters); 
                if(separator != '-')
                  return;
                if (filters && typeof filters.rules !== 'undefined' && filters.rules.length > 0) {
                    rules = filters.rules;
                    for (i = 0; i < rules.length; i++) {
                        rule = rules[i];
                        if (rule.op === 'range') {
                            // Range should only have 2 parts lowerbound and upperbound
                            parts = rule.data.split(separator);
                            if (parts.length == 2) {
                                if (typeof filters.groups === 'undefined') {
                                        filters.groups = [];
                                }
                                group = {
                                    groupOp: 'AND',
                                    groups: [],
                                    rules: []
                                };
                                filters.groups.push(group);
                                // Breaking to 2 rules one le and other ge
                                group.rules.push({
                                            data: (parts[0]),
                                            op: "ge",
                                            field: rule.field
                                        });                             
                                group.rules.push({
                                            data: (parts[1]),
                                            op: "le",
                                            field: rule.field
                                        });                                                                     
                                rules.splice(i, 1);     
                                i--; // to skip i++                             
                            }
                        }
                    }
                    this.p.postData.filters = JSON.stringify(filters);
                }
            },
    
    
     //using range op so that it is not confused with other ops
     setRangeSearchSelect = function(columnName) {
            grid.jqGrid('setColProp', columnName,
            {
               stype: 'select',
               searchoptions: {                                 value:buildRangeSearchSelect(),
                     sopt:['range'],                            
            }
         });
        };
    
     grid.jqGrid('filterToolbar',  
        {
         stringResult:true, 
         searchOnEnter:true,      
         defaultSearch:"cn", 
         beforeSearch: function () {  
           modifySearchingFilter.call(this, '-');    
         }});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need help writing a script downloads data from google insight using c# this is
Need help with deleting call log from multi numbers, using the following code i
Need help on this following code. the problem is it only trigger the last
need help/guide for sql select query, I have 2 table stock and stock_history, in
I would need some help on how to optimize the query. select * from
I have the following query I need help with. SELECT a.artist, a.facepic FROM artists_vs
I actually need help on the thinking process and options, and not really on
Need help to convert code from asp control to input type to fetch file
need help to create regular expression matching string www.*.abc.*/somestring Here * is wild card
need help regarding USSD Gateway. I have to develop an app, which will directly

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.