Our pure JavaScript Scheduler component


Post by hlabatf@colas.com »

After moving a task, the server respond with a fail (controled by server).

How on request fail i can set the task in the original state and removing it from undo/redo queue?

Thanks

Attachments
image002.png
image002.png (29.56 KiB) Viewed 132 times

Post by marcio »

Hey hlabatf@colas.com,

You can use the undo function to reset to the original state https://bryntum.com/products/scheduler/docs/api/Core/data/stm/StateTrackingManager#function-undo

And after that, clear the queue using the following function https://bryntum.com/products/scheduler/docs/api/Core/data/stm/StateTrackingManager#function-resetQueue

Is that what you're looking for?

Best regards,
Márcio


Post by hlabatf@colas.com »

Hi Marcio thanks for your answer.

I will answer, yes partially. Indeed, the behavior we are looking for is :

  • The user move a task

  • The server try to save it and for any reason he send back a fail

  • Currently, the task (event) is store in a queue and replay next time

    What we are looking for is to remove the event for this queue and put back the event at is initial state.

I don't know if it's clear enough?

Best regards,

François


Post by marcio »

Hey François,

It's clear, for that purpose, we have https://bryntum.com/products/scheduler/docs/api/Scheduler/crud/AbstractCrudManagerMixin#function-revertChanges

So you can use like this

onRequestFail({ source }) {
                source.revertChanges();
            }

And to clear the queue you can use the function that I shared earlier https://bryntum.com/products/scheduler/docs/api/Core/data/stm/StateTrackingManager#function-resetQueue

Best regards,
Márcio


Post by hlabatf@colas.com »

Thank you Marcio,

It's working like a charm.

Best regards,

François


Post Reply