Our state of the art Gantt chart


Post by tasnim »


Post by hien.nguyen »

No, I mean: when I change color with CSS

const taskDom = gantt.getElementFromTaskRecord(task);
taskDom.style.backgroundColor = "grey";

This action fire sync event. Please share me sample code that disabled sync event after change background color?

Best regards.


Post by alex.l »

I see no sync event triggered when I changed backgroundColor using the code you provided.
I tried here https://bryntum.com/products/gantt/examples/advanced/
I added sync url and enabled autoSync, but still I don't see any events.

What's your gantt.project.changes object contains after you changed the background?

Please apply required changes to one of our examples to make possible reproduce the issue and attach code here. it will help us to assist you with this question.

All the best,
Alex


Post by hien.nguyen »

Yes, change background color not triggered sync. But when set readOnly for task it fired sync event.

task.readOnly = true;

Best regards.


Post by tasnim »

Hello,

readOnly is the regular taskRecord's field. Any change of task record will initiate sync, if autoSync enabled.

To ignore changes for readOnly field, you could configure the taskModel and set https://bryntum.com/products/gantt/docs/api/Core/data/field/DataField#config-persist to false


Post by hien.nguyen »

Thanks, please share me the way to configure the taskModel to archive this. I've taskModel as below

class MyTaskModel extends TaskModel {
    static get fields() {
        return [
            { name : 'durationUnit', defaultValue : 'hour' }
        ];
    }
}

Best regards.


Post by alex.l »

Here is the code

class MyTaskModel extends TaskModel {
    static get fields() {
        return [
            { name : 'readOnly', persist : false }
        ];
    }
}

All the best,
Alex


Post Reply