Our blazing fast Grid component built with pure JavaScript


Post by mats »

That's inconsistent yes, we'll get that fixed. https://github.com/bryntum/support/issues/3816

Tired of debugging javascript errors in web applications? Try our powerful error logging service RootCause


Post by Yamo1993 »

Awesome, thanks.


Post by Animal »

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 parent
  • parentIndex which defines its position in its parent's children collection.

A change to either of these will result in an update event being fired:

nodemove.gif
nodemove.gif (21.25 MiB) Viewed 25 times

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'
}

Post by Yamo1993 »

Animal wrote:
Fri Nov 26, 2021 10:13 am

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 parent
    parentIndex which defines its position in its parent's children 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.


Post by Animal »

Yes. In that case the event will just be simpler:

{
    record: movedRecord,
    records: [movedRecord],
    changes: {
        parentIndex: {  // <-- only the parentIndex has changed
            value: 3,
            oldValue: 2
        }
    },
    batch: false,
    source: theStore,
    type: 'update'
}

Post Reply