Unable to reorder data after column drag'n'drop.

Unable to reorder data after column drag'n'drop.

qudecqudec Posts: 1Questions: 1Answers: 0

Hi,

Just wondering if I'm the only person in here having this problem:
* I can order data by clicking on a column title
* I can order column by drag n drop
* But after moving a column, clicking on a column title doesn't re-order data.

The column head display reacts to the click (arrow moving for DESC or ASC order), but datas are not ordered.

As I use a LOT of data, I'm using server-side processing.

Any idea how to solve this ?

Answers

  • colincolin Posts: 15,143Questions: 1Answers: 2,586

    Hi @qudec ,

    That's not a known issue. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • droshidroshi Posts: 10Questions: 2Answers: 1

    I have this same issue, I'm using orderData in columns definition to send the correct column number to the server, but after re-ordering a column by drag-and-drop, the number sent to the server changes.

    I'm also using serverSide processing, so basically just looking for the correct number to be sent.

    For me, the orderData sequence originally could be an arbritrary sequence.

    I would try to make a test case, unfortunately I don't see a way to do that for server-side data, I have tried to just add a dummy link, but another problem is that column re-ordering doesn't work in that case. Do you have a serverSide example under the live.datatables.net fiddle area that can be modified?

  • droshidroshi Posts: 10Questions: 2Answers: 1

    I think I have gotten it to reproduce here:
    https://jsfiddle.net/mcaf71tr/

    Unfortunately you can't refresh the page, which helps to show that it is persisting on a refresh, but I believe you can do the following.

    Steps to reproduce:
    1. Open Developer tools and go to Network Tab
    2. Sort any column, example "Position" and note that order[0][column] is 4
    3. Refresh page
    4. Re-order Position further to the right anywhere
    5. Sort Position and note that order[0][column] is incorrectly 3

    If you could refresh and have persistence, it would from then on send 3 to the server, which is the problem. Sometimes just re-ordering a column, if you have initially ordered it once will have it sort one time correctly. But after that the incorrect number gets sent.

  • colincolin Posts: 15,143Questions: 1Answers: 2,586

    Thanks for the fiddle, but it doesn't run. Looking at it though, you're setting columns.orderData for your columns, but they're set to invalid numbers - you've got six columns in your data, yet four of those columns have columns.orderData set to over six! Given that, I wouldn't be surprised if you were seeing odd behaviour.

    Could you correct those values and see if the problem persists, please.

    Colin

This discussion has been closed.