stateSave and colReorder Problem
stateSave and colReorder Problem
In this test case, I use stateSave and colReorder. If I move any column away from its original index and reload the page, the header names of the columns get saved correctly after they were moved, but the position of the column data in the rows data is not saved some reason.
For example, if you move the Office column to Age column, everything looks good, but when you reload the page, the Office column data includes the Age column data and vice versa.
Is it possible to stateSave this correctly?
This question has accepted answers - jump to:
Answers
Seems to work in this example. Please post a link to your page or a test case showing the issue so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Not working for me in this test case: http://live.datatables.net/gosifequ/1/edit
Thanks so much for looking into this @kthorngren !
Looks like a bug when using array data with ajax. It works here with objects:
http://live.datatables.net/sodumidi/1/edit
Nothing in the compatibility chart indicates an issue with ColReorder and StateSave. @allan or @colin will need to take a look.
Kevin
Solution: I confirm that this works correctly for ajax data with objects as here here, but not with arrays.
Hi @trongart @kthorngren ,
Sorry for the delay. I've had a look at this with Allan and we agree that using objects is the way to go for now. I've noted this on a preexisting issue and we will look at it in the future, although we are not sure when that will be!
Thanks,
Sandy
@sandy Thanks for the update! Objects are the way to go in general Please document this in the compatibility matrix or somewhere more appropriate.
Kevin
@kthorngren Yes, sorry I should have said! I have added this to the compatibility matrix - it will be updated the next time the site is rebuilt
Thanks,
Sandy