You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've investigated why it happens. Maybe I found a bug in the RemoveChildAction.undo function.
In the code below, childModels.sort will fail because context.get returns an object, not parentIndex.
Shouldn't it be like context.get(lhs).parentIndex?
If it's a bug, please fix it in the future.
undo() {
const { parentModel, context, childModels } = this;
// Let's sort models by parent index such that models with lesser index
// were inserted back first, thus making valid parent index of models following.
childModels.sort((lhs, rhs) => {
const
lhsIndex = context.get(lhs),
rhsIndex = context.get(rhs);
return (lhsIndex - rhsIndex);
});
// Now let's re-insert records back to where they were
childModels.forEach(m => {
const ctx = context.get(m);
parentModel.insertChild(m, ctx.parentIndex, undefined, { orderedParentIndex : ctx.orderedParentIndex });
});
}
The text was updated successfully, but these errors were encountered:
Forum post
task-order-bug.mov
Hi Bryntum support,
I found an unexpected behavior when I undo removing children.
Sometimes, undoing removing children can't keep children orders.
It can be reproduced at https://bryntum.com/products/gantt/examples/undoredo/.
I've investigated why it happens. Maybe I found a bug in the RemoveChildAction.undo function.
In the code below, childModels.sort will fail because context.get returns an object, not parentIndex.
Shouldn't it be like context.get(lhs).parentIndex?
If it's a bug, please fix it in the future.
The text was updated successfully, but these errors were encountered: