Custom sorting function for variable columns

Custom sorting function for variable columns

devWaleeddevWaleed Posts: 1Questions: 1Answers: 0

Hello devs!

I am using DataTables by simply echoing all table in PHP as normal html and then initializing DataTables over it.

i.e : $('table').DataTable();

But I have some problem. I want to design a custom sorting function which is fine but I don't know how to define it since my number of columns are not always same. They maybe 3 first time, on page refresh they maybe 7 columns.

And I have to design a custom function because normal sorting doesn't work for my case. Have a look at the image.

Image: https://ibb.co/cZ4ZyG

I know how to create custom function, but I don't know how to use on variable columns.

Thanks.

This discussion has been closed.