Hi team,
When I delete task => it deleted already, but after sync (failed to delete on server). Now I want to restore this task again. Please share me the way to do it.
You can use the undoRedo to achieve that.
Here are the steps that you need to follow
stm : {
disabled : false,
autoRecord : true
},
Docs :
https://bryntum.com/products/gantt/docs/api/Core/data/stm/StateTrackingManager#config-autoRecord
https://bryntum.com/products/gantt/docs/api/Core/data/stm/StateTrackingManager#config-disabled
syncFail
listener https://bryntum.com/products/gantt/docs/api/Gantt/model/ProjectModel#event-syncFail
listeners : {
syncFail() {
// undo the change
this.stm.undo();
}
}
Good Luck ,
Tasnim
Thanks for reporting. I've reproduced it. And created a ticket to fix that. Here it is https://github.com/bryntum/support/issues/5678
If you have any other questions please don't hesitate to ask
Good Luck ,
Tasnim
None of this should be necessary.
If using a CrudManager, the server should send back a response which indicates that it could not perform the deletion and the CrudManager should restore it. This is what a CrudManager is for.
It will take me some time to examine the CrudManager source code or tests to find out exactly what this should look like. I will post an update when I have more info.
So if your request packet to the server contained
"events" : { "removed" : [{ "id" : 2 }]}
Then if the server could not perform that operation, the response should be
{
success : true,
type : 'sync',
events : {
rows : [{
id : 2,
...the rest of the data
}],
removed : []
}
}
That is basically adding event 2
back as if it were new.
You should just be able to send back the removed
block as []
to indicate that the remove failed and the CrdManager should restore it.
Here's a ticket about that: https://github.com/bryntum/support/issues/5684