Page 1 of 1

[REACT] Batch unassign event record action

Posted: Fri Mar 17, 2023 4:56 pm
by dphilip

UseCase:

  • On performing unassign action on an event, change the value of property <X> for the event to false (if <X> has been set to true before)
  • On performing redo action, the event should be reassigned to the timeline and change the property <X> back to true (if <X> value was changed during the previous unassign)

P.S. These 2 actions (unassign and setting property <X>) should be a single transaction in undo/redo.

Is there a nice way to implement this?


Re: [REACT] Batch unassign event record action

Posted: Sun Mar 19, 2023 8:19 am
by alex.l

Re: [REACT] Batch unassign event record action

Posted: Mon Mar 20, 2023 4:42 pm
by dphilip
  1. Is there an example that I can take inspiration from?

  2. Unassign seems to be done internally in Bryntum code. How do we manipulate this action?


Re: [REACT] Batch unassign event record action

Posted: Tue Mar 21, 2023 8:14 am
by alex.l

We need exact case to help you here.
NO way to manipulate with internal actions. But you also updated "X" property, you able to catch the moment of change.
In 2 words, you need to disable autoRecord, start transaction before all changes, do required changes and stop transaction after all changes done.
The code for inspiration is below. Not sure what product are we talking about, so it's for the SchedulerPro

schedulerPro.project.stm.startTransaction();
schedulerPro.eventStore.first.name = 'new name';
schedulerPro.eventStore.first.assign(resourceRecord);
schedulerPro.project.stm.stopTransaction();