argument columndef
argument columndef

Hi,
I have a datatable with the first column fixed. I want the text of the first column align to the right and the rest of the columns to the left. and I don't know the number of columns. I would like to do something like this :
columnDefs: [
{ className: "dt-body-right", targets: [1:-1]},
{ className: "dt-body-left", targets: [0]}
],
but the argument targets: [1:-1] are wrong. I don't know how to code 'from column 1 to the last column'.
This discussion has been closed.
Answers
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
As you mention the format you have for
columnDefs.targets
is not supported. The docs state what is supported. Maybe you can add a class to theth
you want to usedt-body-right
.Kevin
Yes i did it with class and it worked thank you !