Column Header Alignment

Tags: #<Tag:0x00007efc6098d218>

How can we get the column header alignment to be Left or Right (not the standard Center only) ?

Topic was posted 3 years ago, but the JS Fiddle is no longer working:


http://jsfiddle.net/s6jj60r7/

It was also raised on the Github page, and those JS FIddle’s aren’t working either.

Any solutions again please?

Thanks

Hey @indirextest2
Would that help http://jsfiddle.net/zk8cqt4b/ ?

Thanks Aleksandra - exactly right.
How can I apply it to certain columns only ? Say Column A and C only

the 1st parameter of the afterGetColHeader hook is column_index so you can use the and IF statement for a certain column

afterGetColHeader: function(col, TH) {
     if(col == 2){
     	TH.className = 'htRight'
     }
 }

http://jsfiddle.net/hdgb8Lxt/

you do not need to use ‘ELSE’ in this case as other columns will get the default, centered alignment.

Perfect, thank you - solved :slight_smile:

Great. Thank you for the update.
We can close the topic.