Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    setCanReorderRecords with sparseUpdates

    Hi,

    It appears that setCanReorderRecords really reorders the underlying data order of the records, does it?

    That then gives a problem with sparseUpdates which mixes the records.
    For instance:

    fetch
    data [
    {id=1, sequence=1, x=A},
    {id=2, sequence=2, x=B},
    {id=3, sequence=3, x=C},
    ]

    Drag record3 above record2 in a grid. Custom client side logic will change the sequence number when the user does that. All other attributes (e.g. the 'x' are untouched).

    sparseUpdates will send all attributes of record3 where record2 was in the new values:
    data [
    {id=1},
    {id=3, sequence=2}
    {id=2, sequence=3}
    ]
    oldValues [
    {id=1, sequence=1, x=A}
    {id=2, sequence=2, x=B}
    {id=3, sequence=3, x=C}
    ]

    and if I understand correctly, DataTools.setProperties will then put attribute x=B on record3 because it was in the 2nd position in the array, which is wrong as it should be x=C (unchanged attribute).


    I have the solution available: for e.g. new records, I add those at the end of the data array and do a client side sort on that field sequence. But it seems that I need to setCanReorderRecords(true) to allow a user to drag and drop a record in that grid. But then I came into this issue.
    I tried cancelling the DragStopEvent, but still the re-order data happened.
    Is there a way I can cancel that from happening?


    thanks

    #2
    You seem to be saying you don't want the user to be able to reorder records, or equivalently, to be able to drop a record in between the existing records. So just setCanReorderRecords(false), it does not need to be enabled in order to allow dropping data.

    Comment

    Working...
    X