Page 1 of 1

[SchedulerPro] Set alwaysWrite on built-in model fields

Posted: Fri Mar 24, 2023 8:37 pm
by guillaume.morin

I'd like to set alwaysWrite=true for fields startDate and endDate in eventModel, so they are always included in the sync request.

I'm unclear how to configure this on built-in fields, could you provide a simple example how to do this ?

https://bryntum.com/products/schedulerpro/docs/api/Core/data/field/DataField#config-alwaysWrite


Re: [SchedulerPro] Set alwaysWrite

Posted: Fri Mar 24, 2023 8:53 pm
by marcio

Hey guillaume.morin,

You can use the following snippet

class MyModel extends EventModel {
    static get fields() {
        return [
            {name: "startDate", alwaysWrite: true},
            {name: 'endDate', alwaysWrite: true}
        ]
    }
}

// CrudManager instance, both Schedulers chains their stores from it
const crudManager = new CrudManager({
    autoLoad: true,
    autoSync: true,
    eventModel: MyModel,
    loadUrl: 'data/data.json',
    syncUrl: 'data/data.json',
});


Re: [SchedulerPro] Set alwaysWrite

Posted: Fri Mar 24, 2023 8:59 pm
by guillaume.morin

Ahhh, I thought this was used to add custom fields, but I see you can also overwrite config for existing ones.
Perfect, working, thanks !


Re: [SchedulerPro] Set alwaysWrite on built-in model fields

Posted: Fri Mar 24, 2023 9:07 pm
by marcio

Glad that worked, feel free to ping us if you need more assistance! :)