Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    did you also activate the new plugin in the WordPress admin area?

    Then, please post a link to the page with the table where the sort is not working. I’ll gladly take a look!

    Thanks!
    Tobias

    Thread Starter nedmic

    (@nedmic)

    I did;) and deactivated / reactivated it also.

    You can find the page here : http://www.alloprod.com/box-office/

    Note that I manually reorganized column (so it’s ok by default when you land on the page), but if you click on the head column “sortie salle” or “sortie DVD”, sorting doesn’t work anymore.

    Elements only sort by day (01 to 31 and vice versa).

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for the link.
    I’m not really sure why the type is not detected automatically here. But we can set this manually, so it should work. Please add this to the “Custom Commands” text field in the “Features of the DataTables JavaScript library” section on the “Edit” screen of the table:

    "aoColumnDefs": [ { "sType": "date-eu", "aTargets": [ 3 ] } ]

    Regards,
    Tobias

    Thread Starter nedmic

    (@nedmic)

    Thanks it works !
    But how can I also include column 8 (“sortie DVD”) to be sortable ?
    I tried :

    “aoColumnDefs”: [ { “sType”: “date-eu”, “aTargets”: [ 3 , 8 ] } ]

    With no success…

    And I can’t sort 3rd column by default when landing on the page.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    for column 8, you need to add a 7 to the code, as the counting starts with 0. This might not always work though, because of the “Non” entries, but you’ll have to try.

    The command for sorting by default can be added after a comma.

    So, in total, you get

    "aoColumnDefs": [ { "sType": "date-eu", "aTargets": [ 3, 7 ] } ], "aaSorting": [[ 2, "asc" ]]

    (The 2 means third column.)

    Regards,
    Tobias

    Thread Starter nedmic

    (@nedmic)

    Yes I counted starting with 0, so I meant column 9 (“sortie dvd”) sorting column 4 (“sortie salle”) by default.

    So code is :

    “aoColumnDefs”: [ { “sType”: “date-eu”, “aTargets”: [ 3, 8 ] } ], “aaSorting”: [[ 3, “desc” ]]

    But I can’t sort column 9 by clicking on arrows and the second part of the code doesn’t seem to work (arrow is highlighted but data don’t sort by desc).

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    ah, I just noted another possible source for this issue: You have connected the first cells in the head row. This is not really supported by the JavaScript library and could be a reason for this. Please remove the #colspan# from that cell to test this.

    Regards,
    Tobias

    Thread Starter nedmic

    (@nedmic)

    Well done 😉
    Column 4 sorts by default when we land on the page.
    But… still have this issue with column 9. Impossible to sort it by clicking on the arrow.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    great 🙂

    I think the reason for that are the “Non” entries, and maybe the empty cells. Can you maybe change all “Non” entries to empty cells? If it still does not work, all cells will need a date.

    Regards,
    Tobias

    Thread Starter nedmic

    (@nedmic)

    Perfect !

    Empty cells solution doesn’t work, but with a date to each cell it does.
    I change for 00.00.0000 if I don’t have the release date.

    Problem solved 😉

    Thank you very much for your time and patience.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    awesome! Great to hear that this worked!

    You could now actually try without extra “Custom Command” for the sorting type again. If you are lucky, it is now recognized automatically.

    Best wishes,
    Tobias

    Thread Starter nedmic

    (@nedmic)

    Unfortunately it doesn’t keep the european date format if I remove the “aoColumnDefs” parameter.
    Maybe you could add the line on the plugin page as an example 😉

    “aoColumnDefs”: [ { “sType”: “date-eu”, “aTargets”: [ 3, 8 ] } ]

    Thread Starter nedmic

    (@nedmic)

    For information, I couldn’ find the datatables section which does not seem to exist.
    http://tablepress.org/documentation/#datatables
    But there is a link to it in “Table Options” > “Use JavaScript library” section.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    hhm, weird. The format was detected in my tests, when I used this the last time… But setting it manually with that “Custom Command” is better anyway, so just keep that command 🙂

    And thanks for the information about the links! It looks like I need to adjust all of them in the Documentation. (They no longer work because I changed the HTML code…)
    The DataTables section is called “Features of the DataTables JavaScript Library”. (I need to extend that though, it doesn’t include a lot of information currently. One reason is that DataTables has its own documentation already at http://www.datatables.net ).

    Best wishes,
    Tobias

    Thread Starter nedmic

    (@nedmic)

    Maybe because of the_date function I don’t know (it’s a french website).
    Anyway it works like a charm that way 😉

    Indeed there is a lot of documentation on datatables.net but I think your explanations are much more comprehensive for novices like me.

Viewing 15 replies - 1 through 15 (of 16 total)

The topic ‘DataTables Sorting plugins not working’ is closed to new replies.