In the multiselect example, there are a list of fruit which can be selected.
If I double click on the event, edit it, and press save, I can run scheduler.getEvent(ID) on it, and there will be a property ‘fruit_id’ which contains a comma separated string of the fruit ids.
However, if I haven’t yet double clicked on the event, scheduler.getEvent(ID) doesn’t contain that ‘fruit_id’ property, even though it does contain all of the other properties such as ‘description’.
Why is this, and how can I change it so that fruit_id is automatically loaded?
Sample database table does not have column for ‘fruit_id’ propertie, so the property appears only after it’s assigned by the lightbox. If you create such column and add it into connectors configuration, it will be loaded initially
But it stores the fruits related to that event in the ‘event_fruit’ table, and by adding a ‘fruit_id’ column in the ‘event’ table, that would cause data duplication, and is therefore more prone to mistakes.
Is there any way to get a list of all of the fruit attached to an event without having to open the edit form (and if possible, without having to make another database call, as that can be quite slow - if that’s the only option, I’ll use that though).
There different data relations.
If you have “one to one” relation - you can add extra field to events table
If you have “many to many” relation - you need to have more complex design ( table for events, table for object and table for links between them )
In second case there are 2 strategy to fetch data
a) collect all data and load at once - which may require a lot of DB queries
b) load data on demand
When you are using multi-selects in scheduler you can chose (a) or (b) solution