Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
TH align according to the colModel align
06/05/2009
11:56
Avatar
snobo
Member
Members
Forum Posts: 34
Member Since:
05/03/2009
sp_UserOfflineSmall Offline

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/05/2009
13:35
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

14/05/2009
01:22
Avatar
snobo
Member
Members
Forum Posts: 34
Member Since:
05/03/2009
sp_UserOfflineSmall Offline

thanx for the tip, will use it as a workaround.

But in my opinion, in future versions of jqGrid the alignment of header cells should by default follow the colModel specifications, do you agree?

17/02/2010
00:24
Avatar
Inara
Member
Members
Forum Posts: 26
Member Since:
27/07/2009
sp_UserOfflineSmall Offline

I would like to second snobo's request for column headers to automatically be aligned according to the colModel alignments. It would make the grid look more natural, and avoid having to call setLabel on every column of every grid.

Thanks,

Matt

25/02/2010
10:32
Avatar
SinErgy
Germany
Member
Members
Forum Posts: 3
Member Since:
25/02/2010
sp_UserOfflineSmall Offline

full ack

same request here...

it's ok to set it manually by setLabel, but many columns makes much more code...

So it would be "natural" if the column header will be aligned according to the colModel and setLabel makes a manual override possible.

thx

Pat

25/02/2010
22:30
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

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

05/06/2010
18:07
Avatar
richtebb
New Member
Members
Forum Posts: 1
Member Since:
05/06/2010
sp_UserOfflineSmall Offline

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

gridComplete: function() {
  $('#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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
74 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information