Add Class to Datatable Elements?
Add Class to Datatable Elements?
I want to add a class to the pagination buttons so that I can use jQuery UI themes. I can see a way to make it look like that by copying the attributes I want to datatable.css but how do you add or change class names on datatable generated elements? It seems from the documentation that sClass only adds classes to table elements not the datatable controls.
This discussion has been closed.
Replies
You are correct in that DataTables doesn't currently provide a method for you to select which classes are applied to the dynamically created elements (it's on the to-do list!) - but there are ways to do what you are looking for:
1. After DataTables as initialised, just added the classes then by querying the DOM and using $.addClass(). This should happen so fast that the user would never see the flicker.
2. Use a plug-in pagination function ( http://datatables.net/development/pagination ) and assign your classes directly in the paging setup function.
Regards,
Allan