Sorting error on third click - request payload missing 'order'

Sorting error on third click - request payload missing 'order'

osit_devosit_dev Posts: 1Questions: 1Answers: 0

Hello.

It's December 2024 and it seems there's still no official solution to this bug.
Can be seen here >> https://datatables.net/forums/discussion/65782/third-click-no-sort and here >>https://datatables.net/forums/discussion/1158 .
Is there a solution coming soon? Is there a recommended work-around for this?

I was able to find out that the request payload is actually missing 'order' data on the third click and such back-end code that listens for this fails and we get >>DataTables warning: table id=myTableIdHere - Ajax error<<

Please and thank you :)

Answers

  • allanallan Posts: 63,700Questions: 1Answers: 10,501 Site admin

    Your two links appear to be asking for the third click to not do any sort. Which is what DataTables 2 now does.

    Your post title suggests that your server-side script (which one are you using?) is always expecting an order parameter, and since there isn't one on the third click, then it throws an error.

    Two options:

    1) Disable the third click no sort behaviour that was asked for in the two threads you linked to. That can be done simply with:

    DataTable.defaults.column.orderSequence = ['asc', 'desc'];
    

    2) Update whatever server-side processing script you are using to not require an order parameter.

    Allan

Sign In or Register to comment.