Sorting based on TH
Sorting based on TH
drjeffpatrick
Posts: 1Questions: 1Answers: 0
Hi,
First of all thanks for the wonderful plugin.
I'm rendering data table with server side data in a Jsp page.
I have a backend variable,
if the variable is true, I will have 7 colomns and the sort index is 5
if I the backend variable is false, I will have 12 colomns. and the sort index is 11
So, is it possible to add a CSS to the TH (like : dataTable-defaultSort )so that the datatable sorting will be on that column initially.
Thanks
Jeff
This discussion has been closed.
Answers
Not directly, but it would only require one additional step to get it working. Add the class you want and then in the DataTable initialisation just find the index of that column and use it as the default sort index:
Allan