Our state of the art Gantt chart


Post by shaveta »

Is there a way to undo/redo the sorting of gantt columns?


Post by mats »

No, there is no way to 'unsort' out of the box but should be easy for you to solve by storing the sorters you apply.


Post by shaveta »

mats wrote: Fri Apr 23, 2021 8:56 pm

No, there is no way to 'unsort' out of the box but should be easy for you to solve by storing the sorters you apply.

Is there any sample code on how to store activities for stm tracker, i have to achieve this for zoom in/zoom out too?

Also i am trying to set one field manually in gantt and looks like sync doesn't trigger. It was working before version 4.1.0.

const me = this;
 me.project.taskStore.allRecords.forEach(function (task) {  
if(task.get('typeOfTask') == 'Project') { task.set(task.data.name, "testing"); } console.log(task);
}); me.editorContext && me.gantt.features.cellEdit.finishEditing(me.editorContext); me.project.sync().catch(() => {});

Can you please have a look and let me know if i need to do anything else to make it work. Is there any changes in code to trigger sync?


Post by mats »

Is there any sample code on how to store activities for stm tracker, i have to achieve this for zoom in/zoom out too?

Sure, have you seen this demo of undo? https://www.bryntum.com/examples/gantt/undoredo/ it shows the STM log which you can save somewhere.

Also i am trying to set one field manually in gantt and looks like sync doesn't trigger. It was working before version 4.1.0.

Hard to say what's going on, if you can produce a small test case we can take a look!


Post by shaveta »

mats wrote: Wed Apr 28, 2021 8:42 am

Also i am trying to set one field manually in gantt and looks like sync doesn't trigger. It was working before version 4.1.0.

Hard to say what's going on, if you can produce a small test case we can take a look!

Can you please try same code inside save method in your php example, steps to reproduce

1)Enable save button on load
2)click zoom in and then trigger save

Basically i want to call sync method each time unless there are changes in data, so that events like zoom in/out etc can be saved


Post by mats »

1)Enable save button on load
2)click zoom in and then trigger save

What would you expect should happen in this case? Zooming is not a data operation so nothing will be saved


Post by shaveta »

mats wrote: Wed Apr 28, 2021 4:38 pm

1)Enable save button on load
2)click zoom in and then trigger save

What would you expect should happen in this case? Zooming is not a data operation so nothing will be saved

I am expecting to trigger sync as i have altered the data, just adding the code from above comment

const me = this;
 me.project.taskStore.allRecords.forEach(function (task) {  
if(task.get('typeOfTask') == 'Project') { task.set(task.data.name, "testing"); } console.log(task);
}); me.editorContext && me.gantt.features.cellEdit.finishEditing(me.editorContext); me.project.sync().catch(() => {});

Post by mats »

Please provide a simple test case that we can debug and clear instructions of how to reproduce the issue you are observing.


Post by shaveta »

mats wrote: Wed Apr 28, 2021 10:04 pm

Please provide a simple test case that we can debug and clear instructions of how to reproduce the issue you are observing.

Can you please try below code in your php example, i have save enabled by default and wants to trigger sync

 onSaveClick() {
        const me = this;
        // finish editing before changes persisting
        me.project.taskStore.allRecords.forEach(function (task) {  //modify project record each time on save
           task.data.name = task.data.name+" test"; 
           task.set(task.data.name, task.data.name+" test");//Appended a space at end of task name            
});
me.editorContext && me.gantt.features.cellEdit.finishEditing(me.editorContext); me.project.sync().catch(() => { // error handling should go here }); }

Post by saki »

Changing data property does not trigger anything, the explanation is here https://localhost/bryntum-suite/Gantt/docs/#Gantt/model/TaskModel#function-setData

The above is only to understand; do NOT use setData method.

Try the following:

me.project.taskStore.allRecords.forEach(function (task) {  //modify project record each time on save
    task.name = task.name + " test";
});

Post Reply