Forum
I find it odd that header cell (TH) alignment does not obey align setting for the corresponding column definition in the colModel. I.e., if we set column to align:right, would be natural if a header cell also got right aligned...
Seemingly minor thing; but the resulting grid with mismatching aligns looks less professional, and clients often notice such minor things... 😉
13:35
Moderators
30/10/2007
Hello,
You can use setLabel method to align the headers like the columns.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
22:30
10/08/2009
Hello everybody!
This feature request looks like now more as a discussion. So I say my personal opinion too.
To have the same column header alignments in a jqGrid as for the column seems for me a very good choice. But from the compatibility side I find good if any change from one jqGrid version to a new one don’t change any default behavior. Users find good to see new features in all new version, but not all users find nice to have a new look in a new version. So I would suggest to introduce a new jqGrid parameter with default column alignment (one global parameter for the whole grid) with value like “center”, “left” and “right” and with something like “inherit”, for example, which means, that column alignment should be inherit from the alignment of the corresponding column. One can have an additional parameter in colModel especially for alignment of the column header, which overwrite column header alignment for a column. With this way one receives maximum flexibility, every could implement his favorite alignment of the column headers, but one will don’t change the default behavior of column alignment for existing grids.
Best regards
Oleg
18:07
05/06/2010
In case anyone wants it, here is some code that will update the column CSS classes to match the column properties. You should call it from your gridComplete event
$('#mygrid').each(function() {
var t = this, i, thclass;
for (i = 0; i < t.p.colModel.length; i++) {
switch (t.p.colModel[i].align) {
case "center": thclass = "ui-th-center"; break;
case "right": thclass = "ui-th-right"; break;
default: thclass = "ui-th-left"; break;
}
}
$(t).setLabel(i, null, thclass);
});
}
Apologies for cut+paste errors – pasting is difficult in this forum.
Most Users Ever Online: 715
Currently Online:
65 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66