Left align header

Left align header

Alex7Alex7 Posts: 1Questions: 1Answers: 0

I am generating a data table from source and cannot find the correct way to change the allignment of the header.
I tried the solution from here: https://datatables.net/forums/discussion/51066/not-able-to-align-the-header-to-the-left
but this did not work.

My desperate try to make it work can be found here: https://jsfiddle.net/1ptdjr93/26/.

Is it possible that the approach is different if the data table is created from source?

Answers

  • kthorngrenkthorngren Posts: 20,276Questions: 26Answers: 4,765

    I'm not a CSS expert but text-right, etc are built into Bootstrap but not sure there is a CSS in Datatables for them. The thread you posted is Bootstrap specific and using a class like that works in your example using Bootstrap:
    https://jsfiddle.net/fv8xngtw/

    For your example without Bootstrap you will need to add your own CSS, for example:

    .text-right {
      text-align: right;
    }
    

    Your updated example without Bootstrap:
    https://jsfiddle.net/05s7wv61/

    I removed the last two lines of your example to rely only on columns.className.

    Kevin

This discussion has been closed.