Our blazing fast Grid component built with pure JavaScript


Post by raghees »

I configured the stm with project data and also add the taskStore to the stm.

this.$refs.gantt.instance.project.stm = new StateTrackingManager({
        autoRecord: true,
        disabled: false
      });

  this.$refs.gantt.instance.project.stm.addStore(
    this.$refs.gantt.instance.project.taskStore
  );
  this.$refs.gantt.instance.project.stm.enable();

  console.log("stores ", this.$refs.gantt.instance.project.stm.stores);
  console.log("length ", this.$refs.gantt.instance.project.stm.length);
  console.log("isReady ", this.$refs.gantt.instance.project.stm.isReady);

screen short of console values is attached.

when I change any thing on my gantt chart the length of stm increases as well but I want to do undo the changes on gantt and I am doing so

      this.$refs.gantt.instance.project.stm.undo();

But it does noting. how to fix this problem?

Attachments
Screenshot.png
Screenshot.png (24.81 KiB) Viewed 57 times

Post by mats »

Can you please upload a full test case that we can run and debug?


Post by raghees »

ah sorry I cannot send you that I am using in my existing project and I cannot separate this module. Is there any other way to debug so you can show the issue?


Post by mats »

Ok no, we need to see and run code to help you. I note that you create your own stm, no need for this. Look at our advanced demo, just configure the stm used by the project. https://bryntum.com/docs/gantt/api/Gantt/model/ProjectModel#property-stm

const gantt = new Gantt({
    appendTo : 'container',

dependencyIdField : 'wbsCode',

project : {
    transport      : {
        load : {
            url : '../_datasets/launch-saas.json'
        }
    },
    autoLoad : true,
    // The State TrackingManager which the UndoRedo widget in the toolbar uses
    stm      : {
        autoRecord : true
    },
    // Reset Undo / Redo after each load
    resetUndoRedoQueuesAfterLoad : true
},

Post by raghees »

Thank you for the reply, basically I want to undo through the code instead of clicking on the button. It is working from the toolbar header but I want to do through code. Is there any way to do so?


Post by mats »

Sure, just call:

project.stm.undo()

Post by raghees »

It works thank you so much


Post Reply