Premium support for our pure JavaScript UI components


Post 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

Last edited by guillaume.morin on Fri Mar 24, 2023 9:00 pm, edited 1 time in total.

Post 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',
});

Best regards,
Márcio


Post 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 !


Post by marcio »

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

Best regards,
Márcio


Post Reply