How to set alignment different for header and content of the same column of the datatable

How to set alignment different for header and content of the same column of the datatable

laxmiparklaxmipark Posts: 22Questions: 8Answers: 0

"columnDefs": [
{ "orderDataType": "dom-input", "className": "dt-center", "targets": [9], "type": "string" },
{
"targets": [13],
"visible": false
},
{
"className": "dt-center", "targets": [4], "type": "string"
},
{
"className": "dt-center", "targets": [5], "type": "string"
},
{
"className": "dt-right", "targets": [8], "type": "string"
},
{
"className": "dt-right", "targets": [10], "type": "string"
},
{
"className": "dt-right", "targets": [11], "type": "string"
},

I would like to have column [8] content right aligned but header center aligned. how to achieve that. now it becomes all right aligned.

Answers

  • colincolin Posts: 15,143Questions: 1Answers: 2,586

    Hi @laxmipark ,

    Yep, you can do that like this:

        columnDefs: [
          {targets: 2, className: 'dt-body-right'}
        ]
    

    See live example here,

    Cheers,

    Colin

  • laxmiparklaxmipark Posts: 22Questions: 8Answers: 0

    Thank you .. It works

This discussion has been closed.