-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Today, reordering (and also inserting & removing) records leads to index & parentIndex of all records after the insertion / removal point being updated. If these are persisted to store the current order of records, it can lead to huge updates.
To have a better way of handing this, implement a sparseIndex field. Which holds a fractional index that is only updated for affected records.
By default, it returns the parentIndex of a record. But if a record is moved etc., it gets a value set. If we have 3 records at:
0 : A, 1 : B, 2 : C
And move C to between A & B we would get sparseIndex:
0 : A, 0.5 : C, 1 : B (C & B got it set, but no change for B)
parentIndex is still updated as today, since it is the actual index in an array:
0 : A, 1 : C, 2 : B
On a sort operation, all sparseIndex fields would need to be cleared.
By persisting sparseIndex, apps can store record order much more cheaply than by persisting parentIndex
Original request https://forum.bryntum.com/viewtopic.php?t=32720