Okay
  Public Ticket #1284838
SQL Order ignored
Closed

Comments

  •  3
    Rob started the conversation

    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?

  •  472
    Isidora replied

    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: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •  3
    Rob replied

    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.

  •  472
    Isidora replied

    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: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •  2
    obidancer replied

    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'? 

  •  472
    Isidora replied

    Hi obidancer,

    Unfortunately that is not possible with built in features of plugin.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables