Sorry to disappoint you, but it is not possible to insert any sorting options into the table shortcode.
For now, these are the functionalities we have available ( and additional workaround if you need to sort by multiple columns) when it comes to sorting :
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.
3. You also asked about rearranging the column order :
Right now, you can only rearrange columns in the table's back-end, by going into the column list, then you will see the icon for 'drag and drop' where you can drag a column with the mouse and then rearrange them.
Yes, it is like that for the time being. If you wish to see this in the future, you can make a development suggestion, but I can't promise an ETA if or when it might become possible.
to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there, and as more people vote, the feature will move higher on the priority list.
You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;
and our newsletter, so you're informed about new features, bug fixes, freebies, etc.
If you have coding skills and wish to try to make a custom solution now,
Can rows and columns be sorted using shortcode? For example [wpdatatable id=1 column_order="2,6,3,4,1,5" row_order="7,4,2,3,1,"]
Hi Omar,
Sorry to disappoint you, but it is not possible to insert any sorting options into the table shortcode.
For now, these are the functionalities we have available ( and additional workaround if you need to sort by multiple columns) when it comes to sorting :
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.
3. You also asked about rearranging the column order :
Right now, you can only rearrange columns in the table's back-end, by going into the column list, then you will see the icon for 'drag and drop' where you can drag a column with the mouse and then rearrange them.
I hope that helps.
Let me know if you have any additional questions.
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
Thanks for your reply, I would have liked to be able to sort using the shortcode :'(
Hi Omar,
Yes, it is like that for the time being. If you wish to see this in the future, you can make a development suggestion, but I can't promise an ETA if or when it might become possible.
Please feel free to search on our suggestions page,
to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there, and as more people vote, the feature will move higher on the priority list.
You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;
and our newsletter, so you're informed about new features, bug fixes, freebies, etc.
If you have coding skills and wish to try to make a custom solution now,
you can check out our available hooks for Developers on this documentation and see if you can find any hook that might help.
We also added this new developer's handbook, which can allow users with coding skills to make custom add-ons.
Our developers will keep adding more custom hooks/examples there over time.
Please be advised that custom solutions with hooks are not included in our support.
You can also research resources such as Stack Overflow to see if any other user perhaps found a workaround.
( We do like to give examples for certain solutions, but for this use-case, we, unfortunately, don't have anything yet)
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