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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:07:03+00:00 2026-05-26T12:07:03+00:00

I have created a filter toolbar based on this example . I have an

  • 0

I have created a filter toolbar based on this example. I have an odd problem; this only works when I have firebug breakpoints set, otherwise, the dropdown only displays ‘All’. The grid is set with datatype:’json’, loadonce:true. One more point; this grid also has a sub grid. Any idea on how to get this working?

 grid = $("#dealsgrid"),
 getUniqueNames = function(columnName) {
       var texts = grid.jqGrid('getCol', columnName); 
       var uniqueTexts = [];
       var textsLength = grid.jqGrid('getGridParam','data');
       var text, textsMap = {}, i;
       for (i = 0; i < textsLength; i++) {
          text = texts[i];
          if (text !== undefined && textsMap[text] === undefined) {
            // to test whether the texts is unique we place it in the map.
            textsMap[text] = true;
            uniqueTexts.push(text);
          }
       }
       return uniqueTexts;
     }, 
 buildSearchSelect = function(uniqueNames) {
       var values = ":All";
       $.each(uniqueNames, function() {
          values += ";" + this + ":" + this;
       });
      return values;
   }, 
 setSearchSelect = function(columnName) {
      grid.jqGrid(
        'setColProp',
        columnName,
        {
            stype : 'select',
            searchoptions : {
                value : buildSearchSelect(getUniqueNames(columnName)),
                sopt : [ 'eq' ]
            }
        });
 };

I after declaring the grid, my column model looks like this:

    colModel:[ 
               {name:'CM',index:'CM', width:50,editable:false},
               {name:'DealNo',index:'DealNo',width:75,editable:false,editoptions:{readonly:true, size:10},search:true, stype:'text', searchoptions: { sopt: ['eq']}},
               {name:'KeyDate',index:'KeyDate',width:100, search:false, align:"right",formatter:'date'},
               {name:'VendorNo',index:'VendorNo', width:75,search:true},
               {name:'VendorName',index:'VendorName', width:100,search:true},
               {name:'ItemQty',index:'ItemQty', width:75,search:false},{name:'StartDate',index:'StartDate',width:100,align:"right",formatter:'date',search:false},
               {name:'EndDate',index:'EndDate',width:100, align:"right",formatter:'date',search:false},
               {name:'ActiveStartDate',index:'ActiveStartDate',width:100, align:"right",formatter:'date',search:false, sorttype:"date", editable:true,editoptions:{size:10}},                   {name:'ActiveEndDate',index:'ActiveEndDate',width:100,align:"right",formatter:'date',search:false, sorttype:"date",editable:true,editoptions:{size:10}},             
               {name:'DealType',index:'DealType', width:75,search:false}

           ],

and finally, my call to create the filterToolBar and populate the dropdown

        setSearchSelect('CM'); 
        grid.jqGrid('setColProp', 'Name', {
        searchoptions : {
            sopt : [ 'cn' ],
            dataInit : function(elem) {
               $(elem).autocomplete({
                  source : getUniqueNames('Name'),
                  delay : 0,
                  minLength : 0
               });
           }
        }

    });
    grid.jqGrid('filterToolbar', {
       stringResult : true,
       searchOnEnter : true,
       defaultSearch : "eq"
    });

Any suggestions would be greatly appreciated.
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-05-26T12:07:04+00:00Added an answer on May 26, 2026 at 12:07 pm

    Removed my old answer now we know that your function is returning something (if you put a breakpoint on it). Could it be that your grid has not yet loaded the data before getUniqueNames is called? This explains that if you put a breakpoint on it, it has more time to load the data before the getUniqueNames is called.

    So if you call the setSearchSelect in the gridComplete or maybe even the loadComplete it should be ok. Maybe you even have to set the async property of the grid to false. I would need to check that with my own code, so I could provide you with a example. I will do this first thing in the morning. In the mean time you could try it yourself by doing some adjustments based on the info above.

       $('#yourgrid').jqGrid({
        ...,
        async: false,
        loadComplete/gridComplete: function() { setSearchSelect('CM'); }
       });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a simple Chebyshev low pass filter based on coefficients generated by
I have a DirectShow filter created with Delphi Pro 6 and the DSPACK direct
Does python have the ability to create dynamic keywords? For example: qset.filter(min_price__usd__range=(min_price, max_price)) I
I have created a filter listview where user will enter input via edittext and
Hello I have created a filter for my list. In a template named _search.gsp
I have created a simple class to filter out data from a data stream.
I have created a custom allocator/presenter that works fine for playback of normal media
Hi I have created a user message page with this plugin. The grid will
I am having problem in django. I have created a form in my app
I've used the example from this post and it works great to create a

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.