I am trying to apply background color for headers in jqgridusing the following code:
$("#" + gridId).jqGrid("setLabel", "Action", "Website", { "background": "red" });
Its working, however if the column's frozen, it's not working. Please help.
I am trying to apply background color for headers in jqgridusing the following code:
$("#" + gridId).jqGrid("setLabel", "Action", "Website", { "background": "red" });
Its working, however if the column's frozen, it's not working. Please help.
Frozen columns implementation is buggy in jqGrid 4.6.0. The most easy way to implement your requirements: upgrade to free jqGrid 4.13.1 and to use labelClasses
property of colModel
(see the demo). Setting of CSS on the column header will be the smallest problem. Free jqGrid is provided under the same licenses (MIT/GPLv2) like jqGrid 4.6.
Only if you really can't update to free jqGrid currently then you will have to set the CS style of the column headers manually. The corresponding code could be like
var $grid = $("#" + gridId);
$($grid[0].grid.hDiv)
.find("tr.ui-jqgrid-labels th")
.eq(pos)
.add(
$($grid[0].grid.fhDiv)
.find("tr.ui-jqgrid-labels th")
.eq(pos))
.css({ background: "red" });
where pos
is the index of the column.
To use columnChooser
you should include ui.multiselect.css
, jquery-ui.min.js
and ui.multiselect.js
. You will find ui.multiselect.*
in plugins subdirectory of jqGrid.