Unfortunately
something like this is not possible with the plugin features at the
moment.
You
can set order by the some column in column settings under tab sorting
an option "Use
as default sorting column". There is
an option "Default
sorting direction" where you can
choose ascending or descending order (attachment).
If
you want to keep the column sorted in some sorting order (ascending
or descending), but to "lock" columns from sorting, you
should have enabled "Sorting"
option under the tab "Sorting
and Filtering"
and to uncheck "Allow
sorting for this column"
for each column under "Sorting"
tab in the column settings.
As a note to others who may encounter this. Sorting by the method proposed only works when you enable sorting "enable sorting for the table". If this is not enabled then the column function associated with sorting are not available.
In summary, to have a column default to a specific sorting order, you must allow the user, via UI, to sort. If you turn off user initiated sorting then you cannot use this feature.
You are right if you turn off "Allowsorting for the table" in main settings of plugin you will not be able to sort columns.
Second if you checked "Use as default sorting column" in column settings you can choose if you want to allow user via UI to sort columns or you can "lock" columns for sorting unchecked option "Allow sorting for this column" for each column under "Sorting" tab in the column settings. So you can use this feature if you turn off user initiated sorting.
Then how can I do to sort multiple columns by default? I read into the documentation that it can be done manually by pressing the shift key and sorting the second column, but how can it be achieve 'on load'?
It appears that the Order By SQL clause is ignored. I have created a table linked to an existing data source.
select * from foo order by foo.name
The records are not displayed using the order of foo.name, rather they are displayed using the order in which they were added to the base table.
Should I be expecting the order by clause to be respected? If not then is there a way to have sorting without the user having to do it themselves?
Hi robchur,
Thank you for your purchase.
Unfortunately something like this is not possible with the plugin features at the moment.
You can set order by the some column in column settings under tab sorting an option "Use as default sorting column". There is an option "Default sorting direction" where you can choose ascending or descending order (attachment).
If you want to keep the column sorted in some sorting order (ascending or descending), but to "lock" columns from sorting, you should have enabled "Sorting" option under the tab "Sorting and Filtering" and to uncheck "Allow sorting for this column" for each column under "Sorting" tab in the column settings.
Kind Regards,
Isidora Markovic
wpDataTables: FAQ | Facebook | Twitter | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Amelia demo sites | Docs
You can try our wpDataTables add-ons before purchase on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables
Thanks for the quick reply Milan.
As a note to others who may encounter this. Sorting by the method proposed only works when you enable sorting "enable sorting for the table". If this is not enabled then the column function associated with sorting are not available.
In summary, to have a column default to a specific sorting order, you must allow the user, via UI, to sort. If you turn off user initiated sorting then you cannot use this feature.
Hi robchur,
You are right if you turn off "Allow sorting for the table" in main settings of plugin you will not be able to sort columns.
Second if you checked "Use as default sorting column" in column settings you can choose if you want to allow user via UI to sort columns or you can "lock" columns for sorting unchecked option "Allow sorting for this column" for each column under "Sorting" tab in the column settings. So you can use this feature if you turn off user initiated sorting.
Best regards
Kind Regards,
Isidora Markovic
wpDataTables: FAQ | Facebook | Twitter | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Amelia demo sites | Docs
You can try our wpDataTables add-ons before purchase on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables
Then how can I do to sort multiple columns by default? I read into the documentation that it can be done manually by pressing the shift key and sorting the second column, but how can it be achieve 'on load'?
Hi obidancer,
Unfortunately that is not possible with built in features of plugin.
Kind Regards,
Isidora Markovic
wpDataTables: FAQ | Facebook | Twitter | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Amelia demo sites | Docs
You can try our wpDataTables add-ons before purchase on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables