That's inconsistent yes, we'll get that fixed. https://github.com/bryntum/support/issues/3816
Support Forum
Indices in the serialized view are not very useful when dealing with a tree because what do they mean?
A move in a tree means removal of a child node from some position in the children
collection of one node and insertion into the children
collection of another node.
Visually, it moves to a different row, but if you are sending updates to a back end to tell it what the data state is in a tree stricture, then the operation is a move between two parents.
This information is available in events. This is a record update
event. A TreeNode has two important fields which define structure.
parentId
which identifies its parentparentIndex
which defines its position in its parent'schildren
collection.
A change to either of these will result in an update
event being fired:
It will look like this:
{
record: movedRecord,
records: [movedRecord],
changes: {
parentId: {
value: 9,
oldValue: 3
},
parentIndex: {
value: 3,
oldValue: 2
}
},
batch: false,
source: theStore,
type: 'update'
}
Animal wrote: ↑Fri Nov 26, 2021 10:13 amIndices in the serialized view are not very useful when dealing with a tree because what do they mean?
A move in a tree means removal of a child node from some position in the
children
collection of one node and insertion into thechildren
collection of another node.visually, it moves to a different row, but if you are sending updates to a back end to tell it what the data state is in a tree stricture, then the operation is a move between two parents.
This information is available in events. This is a record
update
event. A TreeNode has two important fields which define structure.
parentId
which identifies its parent
parentIndex
which defines its position in its parent'schildren
collection.A change to either of this will result in an
update
event being fired:nodemove.gif
It will look like this:
{ record: movedRecord, records: [movedRecord], changes: { parentId: { value: 9, oldValue: 3 }, parentIndex: { value: 3, oldValue: 2 } }, batch: false, source: theStore, type: 'update' }
Interesting. Can the "update" event also be used when moving a node within the same parent?
EDIT: I can see now that it does. This is great information, I will try to work with the update event.