RowReorder after sort does not work - even with order.neutral() plugin

RowReorder after sort does not work - even with order.neutral() plugin

blubboblubbo Posts: 2Questions: 1Answers: 0

I am using RowReorder and it works just great. But I want to be able to sort by columns before and after a manual row reorder. It doesn't matter that the manual reorder will probably get destroyed.

So it's quite obvious that I can't reorder items manually while I have my datatable e.g. sorted by name. I thought using order.neutral() (http://datatables.net/plug-ins/api/order.neutral%28%29) it should reverse the order and cancel any sorting for my table. And that the manual row reorder should be possible again from that point on, but it isn't.

tl;dr: If I "order by column" and then set "order.neutral()" I can't reorder my items by drag and drop anymore. What do I have to do to reverse any order settings back to beginning to be able to manual reorder after sorting by column? (except refreshing the site)

Thank you.

Answers

  • allanallan Posts: 61,950Questions: 1Answers: 10,158 Site admin

    So it's quite obvious that I can't reorder items manually while I have my datatable e.g. sorted by name.

    Why not? RowReorder uses a data swap method, so you should be able to reorder the rows at any time - but the data will be updated.

    Can you link to a test page showing the issue please.

    Allan

  • blubboblubbo Posts: 2Questions: 1Answers: 0

    Well, because if I "order by id ascending" and I drag and drop an item above another item, it won't change its position in the list because the table is still sorted by id and the second id is higher than the first id.

    (It's to note here that I am not changing the dataset itself, but only the representation of the data in the datatable.)

    https://jsfiddle.net/u7mdqwot/

    Do the following:
    1) sort by Salary
    2) Try to swap something (which will only change the seq number)
    3) press on "reset order"
    4) try to change something (will still only change the seq number and not the visible order)

This discussion has been closed.