Our state of the art Gantt chart


Post by cameronp »

When using the clearChanges method on a project model, it does not clear the changes of the dependencies. I'm using my own backend for saving changes, and am clearing this out. For tasks it works fine.

Here is a simple demo showing the issue. If you add a task and press the button you will see the changes object, with the task in it, then it is removed after calling clearChanges.

If you then remove a dependency, and do the same, you will see that the dependency changes are still kept in the changes object after a call to clearChanges

import { Gantt, ProjectModel } from '../../build/gantt.module.js?453246';
import shared from '../_shared/shared.module.js?453246';
/* eslint-disable no-unused-vars */

const project = new ProjectModel({
    transport : {
        load : {
            url : '../_datasets/launch-saas.json'
        }
    },
    // This config enables responses validation and dumping of found errors to the browser console.
    // It's meant to be used as a development stage helper only so please set it to false for production systems.
    validateResponse : true
});

new Gantt({
    appendTo : 'container',

project,

dependencyIdField : 'sequenceNumber',

columns : [
    { type : 'name', width : 250 }
],

// Custom task content, display task name on child tasks
taskRenderer({ taskRecord }) {
    if (taskRecord.isLeaf && !taskRecord.isMilestone) {
        return taskRecord.name;
    }
},

tbar : [
        {
            type        : 'button',
            text : 'clear changes',

        onClick({ pressed }) {
            console.log(project.changes);
            project.clearChanges();
            console.log(project.changes);
        }
    }]

});

project.load();


Post by mats »


Post by mats »


Post Reply