Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jqGrid: how to hide a specific search field in the search toolbar

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?

like image 705
Atticus Avatar asked Jan 05 '11 09:01

Atticus


1 Answers

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.

like image 111
Arun P Johny Avatar answered Nov 09 '22 22:11

Arun P Johny