8

I am using jqGrid with a search toolbar. Now for several columns I do not need the search field, because I do not want to make them searchable (i.e. a column of checkboxes). For these columns I want to hide the search field in the search toolbar. I have read in the jqGrid documentation that the viewable option can be set to false. Here is the part where I set the viewable option:

colModel :[ 
          {name:'checkbox', index:'checkbox', width:'3%', viewable:false},

Here is how I create the search toolbar:

jQuery(function(){
    jQuery("#listTable").jqGrid('filterToolbar',{stringResult: true, searchOnEnter: false});
});

According to the documentation, the viewable option is valid only if the viewGridRow method is activated.

But when I use (activate) the viewGridRow method, that creates another dialog. In that dialog the column whose viewable is set to false does not appear. But I want to hide the search field in the search toolbar not in a new dialog. How can I do that?

I have also tried to get the corresponding div (the one that surrounds my search field) and set its style.display to none. But that does not help.

Is there a way I could hide this search field in the search toolbar?

Atticus
  • 1,622
  • 7
  • 32
  • 55
  • 1
    Possible duplicate of [jqGrid: Search Toolbar disable for some columns?](http://stackoverflow.com/questions/6114613/jqgrid-search-toolbar-disable-for-some-columns) – RandomSeed Apr 11 '17 at 09:06

1 Answers1

19

In your column model add the option search:false for the column where you do not want the search filter. Ex:

{
    label : 'User',
    name : 'name',
    width : 500,
    sortable : false,
    search : false
}

You can find the documentation here.

Arun P Johny
  • 384,651
  • 66
  • 527
  • 531
  • Life Saver, thank you so much. There are so many documentations one can't figure out which is the official one and they all suck. – Tiago_nes Jun 12 '20 at 14:42