Reputation: 6446
We are working on a website where we are using jqGrid to show the data. Now we have a requirement to change the grid header text alignment to left. We are using jqGrid in many places.
We already tried the below method to change the alignment and is working properly.
$("#tableName").jqGrid('setLabel', 'ColumnName', '', {'text-align':'left'});
But as I told this application is using jqGrid in many places. So to change the alignment we have to do updates in many places.
Since this change needs to be done in all places where we are using jqGrid, whether any common place is available to do this update, so that we can avoid updates in many places.
jqGrid Version - 4.5.4
Thanks in advance.
Upvotes: 3
Views: 122
Reputation: 222007
Please write always, which version of jqGrid and from which fork (free jqGrid, Guriddo jqGrid JS or an old jqGrid in version <=4.7) you use.
I develop free jqGrid fork of jqGrid since more as one year and have published many versions of the fork. The current version is 4.12.1. Already in the first version of free jqGrid (see the readme 4.8) I included some simple extensions which you need: new property labelAlign
which allows to align column headers. Possible values are "left"
, "right"
and "likeData"
. No value means center alignments. The old demo demonstrates the usage of new labelAlign
and labelClasses
properties.
If you need
cmTemplate: { labelAlign: "left" }
You can set the value using $.jgrid.defaults
:
$.extend(true, $.jgrid.defaults, {cmTemplate: { labelAlign: "left" }});
see https://jsfiddle.net/OlegKi/h3ksrjmp/
Upvotes: 1