Error when attempting to sort table columns

Error when attempting to sort table columns

timbcusicktimbcusick Posts: 21Questions: 6Answers: 0

This error occurs on any column that the user attempts to sort.

Error is:
jquery.dataTables.js:6129 Uncaught TypeError: Cannot create property 'length' on number '2'
at _fnSortListener (jquery.dataTables.js:6129)

Oddly in _fnSortListener the sorting variable is set to 2, but then later the code is attempting to set sorting.length = 0 which is where it fails understandably.

Debug:
https://debug.datatables.net/ojigow

Thanks,
Tim

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 52,276Questions: 1Answers: 7,963 Site admin

    Hi Tim,

    Thanks for the debug trace. Do you happen to know which table it is that is triggering the error? There are 11 tables on the page.

    Thanks,
    Allan

  • timbcusicktimbcusick Posts: 21Questions: 6Answers: 0

    Hi Allan,

    Yeah sorry should have been more specific. custom-bulkedit is one that is throwing it, but I believe it's any of the *-bulkedit tables

    Tim

  • allanallan Posts: 52,276Questions: 1Answers: 7,963 Site admin
    Answer ✓

    Hi Tim,

    Thanks! I think this is the issue:

    "order": 2,

    The order option takes a 2D array, not just a single integer. If you use:

    order: [[ 2, 'asc' ]]
    

    that should resolve the issue.

    Allan

  • timbcusicktimbcusick Posts: 21Questions: 6Answers: 0

    Thanks Allan. That was it!

This discussion has been closed.