setting text align table head/body

setting text align table head/body

ltdetaltdeta Posts: 23Questions: 9Answers: 0

How can i use the default styling options with

for example how to use "dt-right" with option "columns" and "aocolumns"
i want to show the first column as follow dt-head-right and dt-body-left

Regard,
Carsten

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    edited January 2015

    with

    With what? :-)

    You can use the classes with the columns.className option. There is an example at the bottom of that documentation page showing how to assign a class in the initialisation.

    Allan

  • ltdetaltdeta Posts: 23Questions: 9Answers: 0
    edited January 2015

    what I would therefore like is setting different text-align for column-header and column-data with the "default styling options"
    I don't really understand how to use the syntax for "cell classes"...

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Based on the example from the docs page:

    $('#example').dataTable( {
      "columnDefs": [
        { className: "dt-body-left", "targets": [ 0 ] }
      ]
    } );
    

    Does that make it clearer?

  • ltdetaltdeta Posts: 23Questions: 9Answers: 0
    edited January 2015

    yes, but it doesn't work

    here are the inspector html for "dataTables_scroll" dataTables_scroll.html

    can i also change the column header text-align on the same table with dt-head-center?

    Regard, Carsten

  • ltdetaltdeta Posts: 23Questions: 9Answers: 0

    here is the js datatable configuration DataTableDef

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Can you link me to the page you are working on please. I don't see why that wouldn't work unless you were using an old version of DataTables or its stylesheet.

    Allan

  • ltdetaltdeta Posts: 23Questions: 9Answers: 0
    edited January 2015

    sorry, i am behind a firewall and have no chance to give you access

    here is a jsFiddle based on the example "jQuery UI"

    It also won't work

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    I see - I didn't know you are using the jQuery UI integration stylesheet. That did have the text alignment classes in it. I've just committed the change required to add it and you can download the latest CSS file from here.

    Allan

  • ltdetaltdeta Posts: 23Questions: 9Answers: 0
    edited January 2015

    sorry, i should have also mentioned that

    now it works :)

    Carsten

This discussion has been closed.