"ColumnControl – remove dt-right class from date formatted by moment.js
"ColumnControl – remove dt-right class from date formatted by moment.js
Link to test case: https://live.datatables.net/notomuja/
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
How can I reset className dt-right on date col with moment.js renderer?
DataTable.type('datetime', 'className', '');
DataTable.type('date', 'className', '');
Answers
Solved – you need to manually set the column type. I’m not sure why it doesn’t work without it.
I’ve faced a similar issue when working with date columns formatted using Moment.js. The automatic dt-right class can be a little confusing when the expected alignment is left, so it would be helpful to have a straightforward way to override the default class for specific date columns.
A related discussion about dt-right and column alignment can also be found here:
https://datatables.net/forums/discussion/78174/align-cells-left-after-2-0learn more
How are you setting up the renderer for the date column? You might be able to simply use:
It gets a bit more complicated if you are using a custom format though?
Allan