https://wpdatatables.com/documentation/table-features/sorting/#:~:text=If%20you%20sort%20by%20one,based%20on%20the%20second%20column). doesn´t work neither. clicking on "shift" and selecting the second column, does not change view order....
You can see in the screenshot, any orther keeping SHIFT pressed, doesn´t make any change
Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.
1. First the subject about sorting the table(s) :
If you wish to have the "sort by , then by another column" solution.
1. Regarding the "first, default" column -
Each column has a “Default sorting column” switch in our Column settings/Sorting.
If you enable this switch for one of the columns, a selectbox will appear with options –
2. - The only way users can sort the table by multiple columns with plugin's built-in functionality would be,
on the front-end, if you hold down SHIFT and click on the header of 2(or more) columns. ( for example column B, then C)
Basically, this means that, after the table loads, a page visitor has to do this,
click on the C column whilst holding SHIFT(added the clicked column as a secondary, tertiary etc ordering column)."
But, in case you need this to be "already done before the page loads",
there is a custom workaround, with an SQL Query;
we are not suggesting to use ORDER BY at all in queries,
because wpDataTables plugin is adding it dynamically based on what is set to be default sorting column.
but if you disable the Sorting option for wpDataTable
and create wpDataTable from SQL query e.g:
SELECT * FROM `my_table` ORDER BY ColumnB ASC, ColumnC ASC
It will create and show wpDataTable with multi column sorting, but you will not be able to use Sorting anymore for this table.
2. In regards to the issue you reported, that our 'secondady column sorting' by pressing SHIFT and clicking the second header doesn't work, we are unable to reproduce any issue.
On your screenshots, I can see the first Column has multiple rows with the same value and the second column which seems you clicked as the 'secondary sorting', only has the first row different, which has number 7, then again all the other rows are the same, just number 10.
So I think that is not a good example to test the 'secondary sorting' feature, because it will not change it.
Here is a better example. If you load our Table 1 on the Demo Sandbox, with the "Employees" data.
Let's say if we set the table to sort by column "Position", now we have multiple rows with "Designer" as the first sorting value.
If we hold SHIFT+ click into Header of the "First name" column - we can see how all the other columns now change their sorting based on that secondary column.
You can also download my additional Video as a quick demonstration, too.
You can try it out on the Sandbox Table ID 1 and see how it works.
Let me know if that makes sense and if you have any additional questions about that.
I wish to know how to configure teh datatables default load order by two columns in the backend/wpdatatable config.
I.E: order by NAME DESC and after that ID DESC.
I have a table with this data:
Name: BLOECP23, ID 3
Name: BLOEDP23, ID 2
Name: BLOECP23, ID 1
The default order wholud be: NAME,ID, and the first view should be:
BLOECP23,1
BLOECP23,3
BLOEDP23,2
In the datatables configuration I can select just one filed. When I select the second field, the firstone losts.
Somtehing else to check
https://wpdatatables.com/documentation/table-features/sorting/#:~:text=If%20you%20sort%20by%20one,based%20on%20the%20second%20column). doesn´t work neither.
clicking on "shift" and selecting the second column, does not change view order....
You can see in the screenshot, any orther keeping SHIFT pressed, doesn´t make any change
Attached files: EjemploOrdenamiento.jpg
Hi Adrian,
Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.
1. First the subject about sorting the table(s) :
If you wish to have the "sort by , then by another column" solution.
1. Regarding the "first, default" column -
Each column has a “Default sorting column” switch in our Column settings/Sorting.
If you enable this switch for one of the columns, a selectbox will appear with options –
“Ascending” and “Descending”, where you can choose the sorting direction . More about sorting with our plugin features you can read in our docs here - https://wpdatatables.com/documentation/table-features/sorting/
2. - The only way users can sort the table by multiple columns with plugin's built-in functionality would be,
on the front-end, if you hold down SHIFT and click on the header of 2(or more) columns. ( for example column B, then C)
Basically, this means that, after the table loads, a page visitor has to do this,
click on the C column whilst holding SHIFT(added the clicked column as a secondary, tertiary etc ordering column)."
But, in case you need this to be "already done before the page loads",
there is a custom workaround, with an SQL Query;
we are not suggesting to use ORDER BY at all in queries,
because wpDataTables plugin is adding it dynamically based on what is set to be default sorting column.
but if you disable the Sorting option for wpDataTable
and create wpDataTable from SQL 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.
2. In regards to the issue you reported, that our 'secondady column sorting' by pressing SHIFT and clicking the second header doesn't work, we are unable to reproduce any issue.
On your screenshots, I can see the first Column has multiple rows with the same value and the second column which seems you clicked as the 'secondary sorting', only has the first row different, which has number 7, then again all the other rows are the same, just number 10.
So I think that is not a good example to test the 'secondary sorting' feature, because it will not change it.
Here is a better example. If you load our Table 1 on the Demo Sandbox, with the "Employees" data.
Let's say if we set the table to sort by column "Position", now we have multiple rows with "Designer" as the first sorting value.
If we hold SHIFT+ click into Header of the "First name" column - we can see how all the other columns now change their sorting based on that secondary column.
You can also download my additional Video as a quick demonstration, too.
You can try it out on the Sandbox Table ID 1 and see how it works.
Let me know if that makes sense and if you have any additional questions about that.
Thank you.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables