Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82273

DataTables Align Text Using columnDefs

$
0
0

I'm using DataTables in my app and it works great. To center the text, I'm using:

{ className: 'dt-center', targets: '_all' },

However, for the last column, I want to align the text left instead of center, but the following is having no effect:

{ targets: [ 12 ], className: 'dt-left' }

Here is my complete code:

$('#audits-datatable').DataTable({
    columnDefs: [
        { width: '70px', targets: [ 0, 1, 11 ] },
        { width: '125px', targets: [ 8 ] },
        { width: '600px', targets: [ 12 ] },
        { className: 'dt-center', targets: '_all' },
        { targets: [ 12 ], className: 'dt-left' }
    ],
});

Why is "dt-left" not overriding "dt-center" in column 12? It still shows up aligned centered instead of left.


Viewing all articles
Browse latest Browse all 82273

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>