Datatable orderable option not work in JS Datatable update 1.10.20

Datatable orderable option not work in JS Datatable update 1.10.20

hi,
i update Datatable from 1.10.19 to 1.10.20, and in my column definition always use:

"columns": [
{ "orderable": false },

..
..
]

like docuemntation on: https://datatables.net/reference/option/columns.orderable

With new JS this option is not used by datatable and sorting is always visible like TRUE.

I see in your code not min that there is another option call SORTABLE, without manual definition, and if i change my code like this:

"columns": [
{ "orderable": false, "sortable": false },

..
..
]

sorting its not visible.

Is it correct? why there is no documentation of this change?

thanks

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599
    edited November 2019

    Hi @sergio.mancastroppa@astir.com ,

    It's working here. Could you look at that, please, and see if it helps. If it's still not working for you, please can you update my example, or link to your page, so that we can see the problem.

    Cheers,

    Colin

  • andompandomp Posts: 5Questions: 1Answers: 0

    In case anyone else is having the same issue:

    After some more research, it looks like this is actually intended behavior because the table is by default sorted on the first column. So the indicator is there to show you that the table is sorted on that column. In order to remove the indicator, you need to tell the table to default sort on a different column, or no column at all. In my case, I want my table sorted the same way the data is sent from the server, so I just passed in "order":[] as an option to the table, to disable the default sort. This fixed my problem. Here's the post to the github issue where I found the solution: https://github.com/DataTables/DataTables/issues/339

  • chase439chase439 Posts: 2Questions: 0Answers: 0

    Thank you @andomp , that works! I have something like:

    <table class="datatable responsive" data-order="[]" width="100%">
    <thead>
      <tr role="row">
        <th data-orderable="false">Actions</th>
        <th>Name</th>
      </tr>
    </thead>
    ...
    </table>
    
This discussion has been closed.