EventEdit
Feature
Feature that displays a popup containing widgets for editing event data.
To customize its contents you can:
- Reconfigure built-in widgets by providing override configs in the items config.
- Change the date format of the date & time fields: dateFormat and timeFormat
- Configure provided widgets in the editor and add your own in the items config.
- Remove fields related to recurring events configuration (such as
recurrenceCombo) by setting showRecurringUI config tofalse. - Advanced: Reconfigure the whole editor widget using editorConfig
Built-in widgets
The built-in widgets are:
| Widget ref | Type | Weight | Description |
|---|---|---|---|
nameField |
TextField | 100 | Edit name |
resourceField |
ResourceCombo | 200 | Pick resource(s) |
startDateField |
DateField | 300 | Edit startDate (date part) |
startTimeField |
TimeField | 400 | Edit startDate (time part) |
endDateField |
DateField | 500 | Edit endDate (date part) |
endTimeField |
TimeField | 600 | Edit endDate (time part) |
recurrenceCombo |
RecurrenceCombo | 700 | Select recurrence rule (only visible if recurrence UI is enabled) |
editRecurrenceButton |
RecurrenceLegendButton | 800 | Edit the recurrence rule (only visible if recurrence is used) |
colorField ¹ |
EventColorField | 700 | Choose background color for the event bar |
¹ Set the showEventColorPickers config to true to enable this field
Date and time fields
The date and time fields both keep the full date and time value of the event's start and end instant.
The date and time fields are partner linked pairs. Changing one will update the other to keep the full date/time value.
The start and end instants of the event are kept consistent while editing. Changing the start date/time will adjust the end date/time to keep the same duration.
The min of the end fields is kept in sync to be no earlier than the start instant.
The built-in buttons are:
| Widget ref | Type | Weight | Description |
|---|---|---|---|
saveButton |
Button | 100 | Save event button on the bbar |
deleteButton |
Button | 200 | Delete event button on the bbar |
cancelButton |
Button | 300 | Cancel event editing button on the bbar |
Removing a built-in item
To remove a built-in widget, specify its ref as null in the items config:
const scheduler = new Scheduler({
features : {
eventEdit : {
items : {
// Remove the start time field
startTimeField : null
}
}
}
})
Bottom buttons may be hidden using the bbar config passed to editorConfig:
const scheduler = new Scheduler({
features : {
eventEdit : {
editorConfig : {
bbar : {
items : {
deleteButton : null
}
}
}
}
}
})
To remove fields related to recurring events configuration (such as recurrenceCombo), set showRecurringUI config to false.
Customizing a built-in widget
To customize a built-in widget, use its ref as the key in the items config and specify the configs you want to change (they will merge with the widgets default configs):
const scheduler = new Scheduler({
features : {
eventEdit : {
items : {
// ref for an existing field
nameField : {
// Change its label
label : 'Description'
}
}
}
}
})
Adding custom widgets
To add a custom widget, add an entry to the items config. The name property links the input field to a field in the loaded event record:
const scheduler = new Scheduler({
features : {
eventEdit : {
items : {
// Key to use as fields ref (for easier retrieval later)
color : {
type : 'combo',
label : 'Color',
items : ['red', 'green', 'blue'],
// name will be used to link to a field in the event record when loading and saving in the editor
name : 'eventColor'
}
}
}
}
})
Video guides
For more info on customizing the event editor, please see "Customize event editor" guide.
This feature is enabled by default.
Useful configs and functions
| Member | Description |
|---|---|
| beforeEventEditShow | Fires before the editor is shown |
| beforeEventEdit | Fires before editing starts |
| beforeEventSave | Fires before save, return false to prevent |
| afterEventSave | Fires after event is saved |
| eventEditBeforeSetRecord | Fires before editor binds to a record |
See also
- SimpleEventEdit - Simplified event editor
- EventModel - Event data model
- EventEditor - Event editor popup
Configs
Configs are options you supply in a configuration object when creating an instance of this class-
The current EventModel record, which is being edited by the event editor.
Has a corresponding runtime eventRecord property.
-
A CSS selector targeting elements that should not trigger the editor when clicked.
-
The event that shall trigger showing the editor. Defaults to
eventdblclick, set to''or null to disable editing of existing events.
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of EventEdit class, or subclass thereof.
-
Reference to the cancel button, if used
-
Reference to the delete button, if used
-
Returns the editor widget representing this feature
-
Reference to the end date field, if used
-
Reference to the end time field, if used
-
The current EventModel record, which is being edited by the event editor.
Has a corresponding eventRecord config.
-
Returns true if the editor is currently active
-
Reference to the name field, if used
-
Reference to the resource field, if used
-
Reference to the save button, if used
-
Reference to the start date field, if used
-
Reference to the start time field, if used
-
Identifies an object as an instance of EventEdit class, or subclass thereof.
Functions
Functions are methods available for calling on the class-
Delete event being edited
Triggers: beforeEventDelete
-
loadRecord( )private
Sets fields values from record being edited
-
Saves the changes (applies them to record if valid, if invalid editor stays open)
Triggers: beforeEventSave, beforeEventAdd, afterEventSave