Our pure JavaScript Scheduler component


Post by dennisli »

I have a data model that looks like this:

class MyModel extends EventModel {
    static get fields() {
        return [{
            name: 'ids',
            convert: (value: (string | number)[]) => (value ?
                new Set(value.map((x) => x.toString())) :
                undefined),
        }, ];
    }

This works fine for the initial bryntum page load, but if I try to edit the event, it then tries to execute convert on the already converted value instead of the raw value. This then causes an error e.g. TypeError: value.map is not a function


Post by johan.isaksson »

Hi,

As far as I understand what you are seeing is the intended behaviour, convert is called on each change to make sure the value that will be stored has correct shape.Try checking the incoming type and take action based on that?

Or if you think it is a bug, please supply a complete snippet we can use to reproduce the issue.

Best regards,
Johan Isaksson

Post Reply