Is it possible to sort multiple columns within the plugin? For example "SELECT * FROM table ORDER BY column1, column2 I haven't found it in the demo only sorting for 1 column. And yes I know I can't use ORDER BY in the statement but it is an example.
We are suggesting not to use ORDER BY in MySQL queries because wpDataTables plugin is adding it dynamically based on what is set to be default sorting column. Sorting multi columns is possible when you are holding SHIFT button on your keyboard and then sorting another column.
"User shift click on a column (added the clicked column as a secondary, tertiary etc ordering column)."
Something like that is possible just as a workaround and we are not suggesting to use ORDER BY at all in queries, but if you disable Sorting option for wpDataTable and create wpDataTable from query e.g:
SELECT * FROM `dummy_employees` ORDER BY position ASC, firstname ASC
It will create and show wpDataTable with multi column sorting, but you will not be able to use Sorting anymore for this table.
Hello,
Is it possible to sort multiple columns within the plugin?
For example "SELECT * FROM table ORDER BY column1, column2
I haven't found it in the demo only sorting for 1 column.
And yes I know I can't use ORDER BY in the statement but it is an example.
Regards,
Dave
Hi Dave,
Thank you for the inquiry.
We are suggesting not to use ORDER BY in MySQL queries because wpDataTables plugin is adding it dynamically based on what is set to be default sorting column. Sorting multi columns is possible when you are holding SHIFT button on your keyboard and then sorting another column.
"User shift click on a column (added the clicked column as a secondary, tertiary etc ordering column)."
Hello Milos,
Okay, but it is not possible to do it on the backend? Like you said the default sorting but then multiple columns?
Greetings,
Dave
Hi Dave,
Something like that is possible just as a workaround and we are not suggesting to use ORDER BY at all in queries, but if you disable Sorting option for wpDataTable and create wpDataTable from query e.g:
It will create and show wpDataTable with multi column sorting, but you will not be able to use Sorting anymore for this table.