How to reorder column from responsive?

How to reorder column from responsive?

marky143marky143 Posts: 7Questions: 2Answers: 0
edited June 2020 in Free community support

I have a DataTable. I already implemented the column order and by dragging using jquery-ui .sortable() after the order and the column order will save to database.

Now I got a problem with the responsive because the responsive column isn't ordered.

I want to reorder columns as well as the responsive columns (hidden).
this is my test case: http://live.datatables.net/mulibiwi/1/edit

Thanks

Answers

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

    I want to reorder columns as well as the responsive columns (hidden).

    You can still use the API, order(), to change the order if the column has been hidden responsively.

    Colin

  • marky143marky143 Posts: 7Questions: 2Answers: 0

    Thank you for your response.

    Sorry if my question is not clear. That is not what I mean.

    As you can see in the test case I am using a checkbox element to rearrange the column of what the user wants by using table.colReorder.order(order, true) when I console.log( table.colReorder.order() ) it gives the exact array of index but when I inspect, the column remains hidden.

  • marky143marky143 Posts: 7Questions: 2Answers: 0

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

    Sorry, I'm not getting this. With your test case, please can you give step-by-step instructions on how to reproduce the issue, and also say what you would expect to happen instead.

    Thanks,

    Colin

  • marky143marky143 Posts: 7Questions: 2Answers: 0
    edited June 2020

    Hi Colin,

    Thank you for your response again :)

    I fixed the issue by putting reponsive constructor after table.colReorder.order(order, true)

    new $.fn.dataTable.Responsive( table );

  • mhartmannmhartmann Posts: 2Questions: 0Answers: 0

    Hello marky143,

    this is also very interesting for me.

    The test case ist not working for me.
    Did you find a solution to this and is there an example of it?

    Best regards

  • mhartmannmhartmann Posts: 2Questions: 0Answers: 0

    Sorry marky143,.
    I have found an example by myself.

This discussion has been closed.