Our pure JavaScript Scheduler component


Post by piotr.pysk »

Hi,
I looking for a way to use 2 different types of events (different tooltips, context menus and fields) on one instance of Scheduler. Do I need to have 2 subclasses of EventModel (there is only one "modelClass" in event store config)? Or do I have to distinguish them via some sort of "type" field?


Post by Animal »

You can override createRecord in an EventStore subclass you may use in your app.

https://www.bryntum.com/docs/scheduler/#Core/data/Store#function-createRecord

Or simply inject an implementation of createRecord into the EventStore that you create as part of its configuration object.

Stores call that method when data is loaded from raw JSON, or when you call the add method passing a raw data object instead of a record.

In your createRecord implementation, you can then apply whatever rules you see fit to return in instance of whatever Model class you need.

Obviously, the UIs that use that store must have access to the fields they want from the records in it.

So an EventStore being used by a Scheduler, you can't add a record that doesn't look like an event!

Probably best to derive your special classes from EventModel.


Post Reply