Reputation: 19
I need to increase the jqgrid searchbox width dynamically based on the column width.
I have tried to do this inside beforeshowsearch
event. It doesn't seem to have any effect.
Upvotes: 0
Views: 1442
Reputation: 221997
You can use beforeShowSearch
(!!! not beforeshowsearch
) to make changes in the searching dialog. See here for the code example (you can use this.id
instead of grid[0].id
if you use recent version of jqGrid). I recommend you to use recreateFilter: true
searching option additionally.
By the way navGrid
which add "Search" button to the navigator bar uses width
property of prmSearch
parameter on every call of searchGrid
method which creates the grid. So if you would hold prmSearch
and just change width
the next search dialog will uses new width value:
var pSearch = {
recreateFilter: true,
multipleSearch:true,
width: 500
};
$("#list").jqGrid({...}); // create the grid
$("#list").jqGrid("navGrid", "#pager", {}, {}, {}, {}, pSearch);
// if the user opens searching dialog now the width 500 will be used
...
pSearch.width = 800;
// if the user opens searching dialog now the new width 800 will be used
Upvotes: 3