className doesn't seem to work
className doesn't seem to work
abarnes
Posts: 16Questions: 5Answers: 0
I have been trying using the className option with no success. Here is what I have:
"columnDefs": [
{"className": "semi-bold", "targets": [2]}
],
Any ideas? It is a valid css class and I've tried different ones such as dt-middle etc. No change
This discussion has been closed.
Answers
This is my var. None of the classes are applied:
var table = $('#accounts').DataTable( {
"info": false,
"paging": false,
"filter": false,
"responsive": true,
"serverSide": true,
"ajax": {
url: deviceTBL+'&request=accounts',
type: 'POST'
},
"columnDefs": [
{"orderable": false, "targets": "_all"},
{"className": "clickable", "targets": "_all"},
{"className": "dt-middle", "targets": "_all"},
{"className": "text-center", "targets": [2]}
],
"columns": [
{ data: "accountUser"},
{ data: "accountPass"},
{ data: "accountButton"},
]
} );
You need to combine the classes. Also it seems order is important.
If they are in this order then the
text-center
class is not applied to column 2.In this order the
text-center
plus the others are applied to column 2.See this example:
http://live.datatables.net/xulepeye/1/edit
You can inspect each
td
to verify the classes are applied.Kevin