Replace Sort Icons in DataTables v3
Replace Sort Icons in DataTables v3
I had discussed replacing sort icons in DataTables v2 in the following discussion Replace Sort Icons in Datatable 2.07 in May 2024.
I am just now beginning to update my application from v2 to the latest DataTables v3.1.3 and latest extensions. I have found any discussion about this yet. I am using the browser elements tab to inspect the css and reviewing the dataTables.bootstrap5.css file.
I will continue to look at this over the holiday weekend. Any hints would help.
Answers
Hi,
This is the SCSS file that is used to display the ordering icons. They are basically CSS triangles (i.e. a border on one side of a box) using the
::beforeand::afterpseudo elements of the containingdiv.You'll see a bunch of CSS variables in that file which can be used for basic control of the triangles.
If you want something different from the triangle, have a look at ColumnControl:
The icons are held as SVG in the ColumnControl code, so it is easy to alter them if you have a particular style you want.
Allan
I still might try to override the icons like I did in DataTable v2, but I was a little confused looking at the new style.
So I have decided to try out the ColumnControl since it has some additional features I might be interested in.