Why is the data in the table not aligned properly?
Why is the data in the table not aligned properly?

my page is http://izumov.ultimatefreehost.in/goods007.html
When initiating, for example, I tell the data in the 2nd column to be centered
"columnDefs": [
{"sWidth": "136px", "aTargets": [ 0 ] }, //код
{"sWidth": "136px", "aTargets": [ 1 ],className:'dt-body-center' },
and left alignment is displayed. What is my mistake?
This discussion has been closed.
Replies
Does the column have the class defined in
columns.className
? If so, then the issue is with your CSS.Colin
I had two columns in which I displayed icons and I assigned them class names for subsequent processing of the click event
after adding code to style these columns, I inserted the code before these lines
event handlers stopped working because column class names were redefined. What do i do?
I don't remember which has priority but if you define options using
columns
and the same options usingcolumnDefs
one will overwrite the other. Move the two lines you have incolumnDefs
into the specificcolumns
option. combine thecolumns.className
into one string with spaces separating the classes, for example:className:"position dt-body-center",
.Kevin
followed your advice and rewrote the code
now everything works as it should thanks for the valuable and quick answer