Centering text in column ...
Centering text in column ...
rob morning
Posts: 30Questions: 7Answers: 1
In a datatable I have ..
$('#despatchEntryDetails').dataTable({
"columnDefs": [
{"className": "dt-center", "targets": "_all"}
],
Expected this to centre text in all the columns but it don't seem to be working .. Any ideas ?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I would expect that to work as well, and indeed it does here: http://live.datatables.net/piqukeje/1/edit .
My guess is you are using an old version of DataTables - although without a test case I can't be sure.
Allan
I'm using 1.10.7 .. ?
I would need a link to the page to understand why it isn't working in that case. As you can see from my example it can and should work.
Allan
It's an intranet application .. maybe I can post all the script (it's quite small) but i'm not sure it would help .. I also use Bootstrap ..
Key point. I didn't know that before (which is why the forum rules ask for test cases so I can get all the information required :-) ).
The
dt-center
class is part of the DataTables stylesheet - not Bootstrap, nor the DataTables / Bootstrap integration. I might change that in future, but for the moment you would just add:to your CSS.
Allan
Thanks .. my bad .. works now