Page 4 of 4

Re: [REACT] Remove block screen on sync

Posted: Wed Feb 01, 2023 9:01 am
by tasnim

Re: [REACT] Remove block screen on sync

Posted: Wed Feb 01, 2023 9:07 am
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?


Re: [REACT] Remove block screen on sync

Posted: Wed Feb 01, 2023 1:42 pm
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.


Re: [REACT] Remove block screen on sync

Posted: Thu Feb 02, 2023 3:01 am
by hien.nguyen

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

task.readOnly = true;

Re: [REACT] Remove block screen on sync

Posted: Thu Feb 02, 2023 5:22 am
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


Re: [REACT] Remove block screen on sync

Posted: Thu Feb 02, 2023 5:34 am
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' }
        ];
    }
}

Re: [REACT] Remove block screen on sync

Posted: Thu Feb 02, 2023 5:44 am
by alex.l

Here is the code

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