Palanikumar / jquery-datatables-row-reordering

Automatically exported from code.google.com/p/jquery-datatables-row-reordering
0 stars 0 forks source link

When multiple rows affected by change; only one gets callback #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Two or more rows

What is the expected output?
When a row is moved, at least two rows are affected. Only the row being moved 
receives a callback.
Example:
A table has 5 rows, with sort IDs 1,2,3,4,5.
After moving row 5 to the beginning, every row has its sortID changed 
(1=>2,2=>3,3=>4, 4=>5, 5=>1)
I would expect 5 ajax callbacks, one for each row affected

What do you see instead?
Only the dragged row receives a callback (Row 5 in our example, with 
fromPosition=5 and toPosition = 1)
The ajax server (database) never gets notified that the sort IDs of the other 
rows was affected by the change. After a row is moved, there is no way for the 
database to know what the new displayed values are. Data corruption occurs, as 
two rows may have the same sortID after only one row is updated.

What version of the product are you using? On what operating system?
1.0.0; tested on MacOSX 10.7, WInXP, WIn7, Chrome, FireFox,IE9, Safari

Please provide any additional information below.
http://jsfiddle.net/psmerd/x5LaN/1/# has been set up to mimic the examples 

Original issue reported on code.google.com by psm...@gmail.com on 26 Nov 2012 at 11:18

GoogleCodeExporter commented 8 years ago
Does this issue have a work around or resolution. I have the same issue. I can 
work it in the database, but that would require refreshing the list from the 
database after each change. Is this possible?

Original comment by chris_ni...@hotmail.com on 22 Mar 2013 at 1:33

GoogleCodeExporter commented 8 years ago
The idea is to send just one Ajax call. On the server side you are getting 
start and end index so assumption is that when you get the boundaries, you will 
apply the same logic on the server side (1=>2,2=>3,3=>4, 4=>5, 5=>1).
It would be highly inefficient to send 100 Ajax request if you show 100 rows 
per page and put first one to the end.

Jovan

Original comment by joc...@gmail.com on 27 May 2013 at 8:57