v7.3.0
SupportExamplesFree Trial

EventEdit
Feature

Feature that displays a popup containing widgets for editing event data.

targetElement.innerHTML = '<p>Double click an event to show the event editor, or click + drag empty area to create a new one with the editor:</p>'; const scheduler = new Scheduler({ appendTo : targetElement, // makes scheduler as high as it needs to be to fit rows autoHeight : true, startDate : new Date(2018, 4, 6), endDate : new Date(2018, 4, 13), columns : [ { field : 'name', text : 'Name', width : 100 } ], resources : [ { id : 1, name : 'Bernard' }, { id : 2, name : 'Bianca' } ], events : [ { id : 1, resourceId : 1, name : 'Double click me', startDate : '2018-05-08', endDate : '2018-05-11' } ] });

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 to false.
  • 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

No results

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.

  • The week start day used in all date fields of the feature editor form by default. 0 means Sunday, 6 means Saturday. Defaults to the locale's week start day.

  • A CSS selector targeting elements that should not trigger the editor when clicked.

  • True to save and close this panel if ENTER is pressed in one of the input fields inside the panel.

  • triggerEvent : Stringeventdblclick

    The event that shall trigger showing the editor. Defaults to eventdblclick, set to '' or null to disable editing of existing events.

  • This config parameter is passed to the startDateField and endDateField constructor.

  • This config parameter is passed to the startTimeField and endTimeField constructor.

  • Internal listeners, that cannot be removed by the user.

  • The widget which this plugin is to attach to.

    Has a corresponding runtime client property.

  • Set to false to disable localization of this object.

  • Set to false to hide recurring fields in event editor, even if the Recurring Events is true and a recurring event is being edited.

Properties

Properties are getters/setters or publicly accessible variables on this class
  • isEventEdit : Booleantrue
    READONLY
    static
    ADVANCED
    Identifies an object as an instance of EventEdit class, or subclass thereof.
  • isEvents : Booleantrue
    READONLY
    static
    ADVANCED
    Events
    Identifies an object as an instance of Events class, or subclass thereof.
  • isLocalizable : Booleantrue
    READONLY
    static
    ADVANCED
    Localizable
    Identifies an object as an instance of Localizable class, or subclass thereof.
  • isRecurringEventEdit : Booleantrue
    READONLY
    static
    ADVANCED
    RecurringEventEdit
    Identifies an object as an instance of RecurringEventEdit class, or subclass thereof.
  • properties : Object
    internal
    static
    EditBase

    A class property getter for the default values of internal properties for this class.

  • cancelButton : Button
    READONLY

    Reference to the cancel button, if used

  • deleteButton : Button
    READONLY

    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.

  • isEditing : Boolean
    READONLY

    Returns true if the editor is currently active

  • nameField : TextField
    READONLY

    Reference to the name field, if used

  • resourceField : Combo
    READONLY

    Reference to the resource field, if used

  • saveButton : Button
    READONLY

    Reference to the save button, if used

  • Reference to the start date field, if used

  • Reference to the start time field, if used

  • emptyArray : Array
    internal
    READONLY
    EditBase

    An empty array that can be used as a default value.

  • emptyObject : Object
    internal
    READONLY
    EditBase

    An empty object that can be used as a default value.

  • isEditBase : Booleantrue
    READONLY
    ADVANCED
    EditBase
    Identifies an object as an instance of EditBase class, or subclass thereof.
  • isEventEdit : Booleantrue
    READONLY
    ADVANCED
    Identifies an object as an instance of EventEdit class, or subclass thereof.
  • isInstancePlugin : Booleantrue
    READONLY
    ADVANCED
    EditBase
    Identifies an object as an instance of InstancePlugin class, or subclass thereof.
  • config : Object
    READONLY
    ADVANCED
    EditBase

    Returns a copy of the full configuration which was used to configure this object.

  • isConstructing : Boolean
    READONLY
    ADVANCED
    EditBase

    This property is set to true before the constructor returns.

  • isDestroying : Boolean
    READONLY
    ADVANCED
    EditBase

    This property is set to true on entry to the destroy method. It remains on the objects after returning from destroy(). If isDestroyed is true, this property will also be true, so there is no need to test for both (for example, comp.isDestroying || comp.isDestroyed).

  • client : Widget
    READONLY
    ADVANCED
    EditBase

    The Widget which was passed into the constructor, which is the Widget we are providing extra services for.

    Has a corresponding client config.

  • Get the global LocaleHelper

  • Get the global LocaleManager

  • Reference to the button that opens the event repeat settings dialog, if used

  • Reference to the Repeat event field, if used

Functions

Functions are methods available for calling on the class
  • onClassMixedIn( )
    internal
    static
    EditBase

    This optional class method is called when a class is mixed in using the mixin() method.

  • initClass( )
    static
    ADVANCED
    EditBase

    Registers this class type with its Factory

  • deleteEvent( )
    private
    ASYNC

    Delete event being edited


    Triggers: beforeEventDelete

  • loadRecord( )
    private

    Sets fields values from record being edited

  • save( )
    private
    ASYNC

    Saves the changes (applies them to record if valid, if invalid editor stays open)


    Triggers: beforeEventSave, beforeEventAdd, afterEventSave

  • Updates record being edited with values from the editor

  • Internal function used to hook destroy() calls when using thisObj

  • Internal function used restore hooked destroy() calls when using thisObj

  • doDestroy( )
    internal
    Events

    Auto detaches listeners registered from start, if set as detachable

  • once( )
    private
    Events

    Internal function used to run a callback function after an event is triggered

  • Removes all listeners registered to this object by the application.

  • This will merge a feature's (subclass of InstancePlugin) keyMap with it's client's keyMap.

Events

Events are triggered for certain actions in this class and can be listened for to react to those actions in your code

Event handlers

Event handlers are callbacks called as a result of certain actions in this class
id: eventEdit

Source path

Scheduler/feature/EventEdit.js

Demo

examples/eventeditor

Contents