Our blazing fast Grid component built with pure JavaScript


Post by matteopasqualin »

Hello,

I'am evaluating the Gantt product as newcomer and would like to know if it is possible to get all fields of the UPDATED Task in the sync operation. Docs say it's possible but I can't get it to work.
In the first SYNC operation (it creates new Task) the request is ok, but when I update the new one created only the id and name fields are present.

Please have a look at my code, very similar to the Advanced demo, in Angular.

HTML
<bry-gantt
                #gantt
                [height]="heightDiv"
                [columns]="ganttConfig.columns"
                [project]="ganttConfig.project"
                [viewPreset]="ganttConfig.viewPreset"
                [rowHeight]="ganttConfig.rowHeight"
                [barMargin]="ganttConfig.barMargin"
                [stripe]="ganttConfig.features.stripe"
                [taskEdit] = "ganttConfig.features.taskEdit"
                [startDate]="ganttConfig.startDate"
                [endDate]="ganttConfig.endDate"
                (onGanttEvents)="onGanttEvents($event)"
            ></bry-gantt>
.TS

ngOnInit

this.ganttConfig.project.load({}).then(data => {
  
            const stm = this.ganttConfig.project.stm;

            this.ganttConfig.project.on('schedulingconflict', context => {
                Toast.show('Scheduling conflict has happened ..recent changes were reverted');
                context.continueWithResolutionResult(EffectResolutionResult.Cancel);
            });

            Toast.show('All fine...');

            stm.enable();
            stm.autoRecord = true;
            
        }).catch(response => {
            // show notification with error message
            Toast.show(response && response.message || 'Unknown error occurred');
        });
        
.CONFIG TS
const project = new ProjectModel({
    transport: {
        load: {
            url: 'assets/gantt-data-new.json'
        },
        sync: {
            requestConfig: {
                url: '/api/projects/syncgantt',
                headers: {
                    'Authorization': 'Bearer token***',
                    'Content-Type' : 'application/json; charset=utf-8'
                }
            }
        }
    },
    phantomIdField:'sysPhantomId',
    autoLoad: false,
    autoSync: true,
    writeAllFields : true
});

export default {
    columns: [
        { type: 'wbs', width: 60 },
        { type: 'name', field: 'name', text: 'Name', width: 250 },
        { type: 'startdate' },
        { type: 'duration' },
        { type: 'percentdone', width: 70 }
    ],
    rowHeight: 50,
    barMargin: 7,
    viewPreset: 'weekAndMonth',
    startDate : new Date(2020,3,1),
    endDate : new Date(2020, 3, 6),
    features: {
        stripe: true,
        timeRanges : {
            showHeaderElements  : true,
            showCurrentTimeLine : true
        }
    },
    project
}

The ProjectModel writeAllFields property has no effects, true or false is the same.

Can you please help on that?

Thank you

Matteo

Post by saki »

Try to put it in the `transport` object.

Side note: Sending all fields to the server may cause race conditions in multiuser applications. Ideally, only the changed fields are updated. This way can one user, for example, update an address and another user phone number in the same record without overwriting each-other data.

Post by matteopasqualin »

Hello saki,

thanks for reply. I'll bear in mind the race conditions note.

No luck, none of the solutions below do work:
const project = new ProjectModel({
    transport: {
        load: {
            url: 'assets/gantt-data-new.json'
        },
        sync: {
            requestConfig: {
                url: '/api/projects/syncgantt',
                headers: {
                    'Authorization': 'Bearer token***',
                    'Content-Type' : 'application/json; charset=utf-8'
                }
            },
            writeAllFields : true // CASE 2
        },
        writeAllFields : true // CASE 3
    },
    phantomIdField:'sysPhantomId',
    autoLoad: false,
    autoSync: true,
    writeAllFields : true // CASE 1
});
How can I solve it?

Post by saki »

This seems to be a bug. The ticket is here: https://github.com/bryntum/support/issues/366

Post by matteopasqualin »

I saw it.

Thank you.

Post by mats »

Fixed now!

Post by matteopasqualin »

Great.

In that case how can I apply the fix to my code and test it? Do I have to download the trial and rebuild it?
I searched in docs, but I can't find any documentation on versions migration or update.
Is there a release roadmap?

Thank you

Post by mats »

You need licensed version to download our nightly builds. Or you have to wait until our next official release to redownload trial. For a workaround you can define store properties on the Project and include 'writeAllFields : true' on those.

Post by matteopasqualin »

Fine.

Thank you

Post Reply