Hey everyone!

With the holiday season upon us, we want to share our upcoming working hours:

After that, we’ll return to our regular schedule and assist you as quickly as possible.

In the meantime, you can explore our documentation for Amelia and wpDataTables. You'll find tons of helpful resources, including articles and handy video tutorials on YouTube (Amelia's YouTube Channel and wpDataTables' YouTube Channel), which might just have the answers you need while we’re away.

Thanks a bunch for your understanding and support!

Warm regards and happy holidays!

TMS

Okay
  Public Ticket #2920914
sorting
Closed

Comments

  • Freddie Cheung started the conversation

    In my SQL table, i have a filterable column of strings organised in the sequence of :

    1.0

    1.1

    1.2

    .

    .

    .

    2.0

    2.1

    ..

    18.0

    18.1

    ...

    i would like to human sort i.e. in the above order instead of :

    1.0, 1.1, ...10.0, 10.1,....2.0, 2.1,........

    is there any way to achieve this?

  •  1
    Sue Hemmens replied

    While you're waiting (I know the team at TMS are short-handed due to covid) have a look at this post on stackoverflow, might help https://stackoverflow.com/questions/153633/natural-sort-in-mysql

  •  472
    Isidora replied

    Hi Freddie,

    Thank you for your purchase.

    Sorry for the late response, we have some agents that have contracted Covid-19, so our team is cut in half.

    Yes that is default behavioral for sting columns. Like Sue suggest you have to adopt this with some custom query and some of the solutions you can find on link that Sue provide. 

    One more suggestion is to check those queries in your database tool(phpmyadmin or what every you use) and when it is returning data that you need pelase create a view so you will avoid issues with server side options like filtering, searching.. because wpdatatables have dynamic logic for recreating queries and when your initial query is complicated this can provide not proper rendering and will throw no results.

    Thank you Sue for help.

    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

  •   Freddie Cheung replied privately
  • [deleted] replied

    Hi Freddie

    This is a bit too complicated query to be handled simply by wpDataTableas so please prepare a MySQL view (a stored query), which will return the data that you need, call it e.g. “view1” and then build a wpDataTabled based on a simple query like “SELECT * FROM view1″.

    Please note some this when working with the server-side processing feature:

    • Please do not use “LIMIT” in the SELECT statement. wpDataTables adds it automatically and it will be overridden.
    • Please do not use “ORDER BY” in the SELECT statement. wpDataTables has its own sorting engine so it makes no sense to use MySQL’s sorting, since it will be overridden. Also, server-side processing feature adds this part of statement automatically when users trigger the sorting on the front-end, and having it in initial statement may cause the table to crash.