Order option not working when given in the form of an object

Order option not working when given in the form of an object

ajayphadeajayphade Posts: 3Questions: 0Answers: 0

Link to test case: https://live.datatables.net/pubamusa/15/edit?html,js,output

Debugger code (debug.datatables.net): izoviz
It's showing that DataTables v1 is no longer supported. But, as per the documentation, it should work on DataTables version >= 1.10 https://datatables.net/reference/option/order

Error messages shown: No error message is shown in the console after initialization. Although, following error is shown in the console when I try to manually order the table by clicking on any of the headings of the columns:

Uncaught TypeError: l.push is not a function
    at se (jquery.dataTables.min.js:4:43571)
    at jquery.dataTables.min.js:4:43815
    at HTMLTableCellElement.<anonymous> (jquery.dataTables.min.js:4:46963)
    at HTMLTableCellElement.dispatch (jquery.min.js:2:43064)
    at y.handle (jquery.min.js:2:41048)

Description of problem: I am not able to use the object form of the order type https://datatables.net/reference/type/DataTables.Order#Object---index-based . There are many other features in my actual project which are working fine even with this error.
I am able to use the array form of the order type which works fine. I want to use the object form so that I am also able to order the table using the names of the columns when I introduce the names of the columns.

Replies

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    The option works in 1.10+, but as an object, it requires DataTables 2. I'll add that to the documentation.

    Allan

  • ajayphadeajayphade Posts: 3Questions: 0Answers: 0

    Ok, thanks Allan. So, I will have to upgrade DataTables to the latest version (2.0.7).

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    If you want to use that form rather than the 2D array, yes. The 2D array will work with 1.10+.

    Allan

  • ajayphadeajayphade Posts: 3Questions: 0Answers: 0

    Ok, thanks for the answer.

Sign In or Register to comment.