Is it possible to open and close the search function of certain columns after loading Jgrid?
The underlying code allows you to hide the search part, but does not affect the search function
It works fine to hide but I haven't found what I need to do to show it
this code does not affect the search function
I have to influence the search
$("#gs_name").closest(".ui-search-table").hide();
UPDATE
The desired combination in the Client Name column
search = hidden -> search = false
search = show -> search = true
$("#columnhide").click(function(){
$("#gs_name").val("")
$("#gs_name").closest(".ui-search-table").toggle();
});
The hidden property in double click is a property of colModel. In your case you should use the jquery selector :hidden to do the job.
The code can be changed like this:
ondblClickRow: function(rowid, iRow, iCol, e) {
var cm = $(this).jqGrid("getGridParam", "colModel");
var cmvalues = $(this).jqGrid("getRowData", rowid);
$.each(cm, function(i,n){
if(!n.hidden) {
var elem = $('#gs_'+n.name);
if( elem.is(":hidden") {
// set it to empty to overcome search when trigger
elem.val("");
} else {
elem.val( cmvalues[n.name]);
}
}
});
this.triggerToolbar();
},