[]
        
(Showing Draft Content)

FlexScheduler Class

FlexScheduler Class

Displays and manages events in configurable time-based and resource-based views.

Set itemsSource to an array or ICollectionView, then use definition, eventFields, and resources to describe how source items are projected onto the Scheduler surface.

Heirarchy

Constructors

constructor

  • Initializes a new instance of the FlexScheduler class.

    Parameters

    • element: any

      The host element or CSS selector used to create the control.

    • Optional options: any

      An optional object used to initialize the control properties.

    Returns FlexScheduler

Properties

allowDragEvent

allowDragEvent: boolean

Gets or sets a value that determines whether Scheduler event items can be moved with the mouse. This option affects Scheduler event-item interaction only; it does not move any other content. The default value is true.

allowResizeEvent

allowResizeEvent: boolean

Gets or sets a value that determines whether timed Scheduler event items can be resized with the mouse. This option affects Scheduler event-item interaction only; it does not resize any other content. The default value is true.

collectionView

collectionView: ICollectionView | null

Gets the ICollectionView used by the Scheduler, or null when no itemsSource is assigned.

contextMenu

contextMenu: SchedulerMenu

Gets or sets the schedulerMenu used by the Scheduler surface.

definition

Gets or sets the definition that controls the active Scheduler layout and item template.

The getter returns a defensive copy so changes take effect only after assigning a definition back to this property. Assigning an unsupported definition throws an error without changing the active definition or rendered view.

displayDate

displayDate: Date

Gets or sets the date used as the anchor for the active view.

Changing this property updates the visible date range and raises displayDateChanged.

eventFields

Gets or sets the field names used to read event subjects, start times, end times, and description.

Fields that are not supplied use the Scheduler defaults.

By default, the fields in the event data need to include the required start and end, and possibly subject and description as well. If the fields in the original data don’t meet the requirements or can’t be changed, you can use eventFields to map them.

For example, if the event data has startDate, endDate and title fields instead of start, end and subject, you can use:

const data = [
    {
        title: 'Event 1',
        startDate: new Date(2023, 0, 1),
        endDate: new Date(2023, 0, 1, 1),
        information: 'a sample event.'
    }
];

scheduler.eventFields = {
    subject: 'title',
    start: 'startDate',
    end: 'endDate',
    description: 'information'
};

The getter returns a defensive copy so changes take effect only after assigning a definition back to this property.

hostElement

hostElement: HTMLElement

Gets the DOM element that is hosting the control.

isDisabled

isDisabled: boolean

Gets or sets a value that determines whether the control is disabled.

Disabled controls cannot get mouse or keyboard events.

isTouching

isTouching: boolean

Gets a value that indicates whether the control is currently handling a touch event.

isUpdating

isUpdating: boolean

Gets a value that indicates whether the control is currently being updated.

itemsSource

itemsSource: any

Gets or sets the event data displayed by the Scheduler.

Assign an array or ICollectionView. When a collection view is supplied, filtering, sorting, paging, and collection change notifications are preserved.

nonworkingTime

nonworkingTime: SchedulerNonworkingTime[]

Gets or sets explicit date-time ranges that are always treated as non-working.

These exceptions take precedence over workDays and {@link workHours}. The getter returns a deep copy.

For example, nonworkingTime = [{ start: new Date(2026, 6, 23, 12), end: new Date(2026, 6, 23, 13) }] marks the noon hour of July 23, 2026 as non-working.

resources

Gets or sets the resource descriptors used to group events and edit resource assignments.

Each descriptor maps an event field to an array or collection view of resource items. The getter returns a copy of the descriptor array.

rightToLeft

rightToLeft: boolean

Gets a value indicating whether the control is hosted in an element with right-to-left layout.

scrollingPartner

scrollingPartner: FlexScheduler | null

Gets or sets another Scheduler whose scroll position is synchronized with this Scheduler.

Set scrollingSyncDirection to choose which axes are synchronized.

For predictable results, use the same definition on synchronized Schedulers. When synchronized Schedulers use different definitions, their scrollable ranges may be different. In that case, synchronization copies the current scroll offsets from the Scheduler that scrolled most recently. A Scheduler with a longer scroll range may therefore be clamped or moved backward when it receives a scroll offset from a Scheduler with a shorter scroll range.

When a synchronized Scheduler changes to a different definition, the new scroll element starts from the previous scroll distance restored by the browser/control refresh cycle before subsequent scroll synchronization is applied.

scrollingSyncDirection

scrollingSyncDirection: ScrollingSyncDirection

Gets or sets which scroll axes are synchronized with scrollingPartner.

showColumnHeaders

showColumnHeaders: boolean

Gets or sets a value that determines whether Scheduler column headers are displayed. The default value is true.

showRowHeaders

showRowHeaders: boolean

Gets or sets a value that determines whether Scheduler row headers are displayed. The default value is true.

showToolbar

showToolbar: boolean

Gets or sets a value that determines whether the scheduler toolbar is displayed.

The default value for this property is true.

tabOrder

tabOrder: number

Gets or sets a value of the tabindex attribute associated with the control.

tabindex attribute value can be defined statically for a Wijmo control by specifying it on the control's host HTML element. But this value can't be changed later during application lifecycle, because Wijmo controls have complex structure, and the control may need to propagate this attribute value to its internal element to work properly.

Because of this, to read or change control's tabindex dynamically, you should do it using this property.

timeZone

timeZone: string | null

Gets or sets the IANA time zone used to display and navigate event dates.

Set this property to null to use the browser's local time zone.

toolbarViewItems

toolbarViewItems: SchedulerViewItem[]

Gets or sets the view selector buttons displayed in the Scheduler header.

Each SchedulerViewItem supplies the button text and key. A built-in enum key uses its preset definition when definition is omitted. Custom string keys require a matching definition. Invalid items and duplicate resolved keys are ignored, preserving the order of the first valid occurrence. The getter returns a deep copy of each item with its resolved definition, so update the property by assigning a new array.

The default value contains Day, Week, Work Week, Month, Timeline Day, Timeline Week, and Timeline Month buttons using the current culture.

workDays

workDays: SchedulerWorkDays | null

Gets or sets the weekly working-time schedule.

The value must contain exactly seven SchedulerWorkHours entries in Sunday-to-Saturday order. Each entry contains SchedulerWorkHourRange values for that weekday. An empty entry means that weekday is non-working.

The default value is null, which disables the weekly rule. Assigning null to the entire property leaves working time unrestricted by this source. Timed views use the selected entry to style each time slot, and summary views use it to style the corresponding day. When workDays is configured, workHours is ignored. The getter returns a deep copy, so mutating a returned range does not change the scheduler state.

scheduler.workDays = [
    [],
    [{ start: '09:00', end: '18:00' }],
    [{ start: '09:00', end: '18:00' }],
    [{ start: '09:00', end: '18:00' }],
    [{ start: '09:00', end: '18:00' }],
    [{ start: '09:00', end: '12:00' }],
    [],
];

Methods

addEventListener

  • addEventListener(target: EventTarget, type: string, fn: any, capture?: boolean, passive?: boolean): void
  • Adds an event listener to an element owned by this Control.

    The control keeps a list of attached listeners and their handlers, making it easier to remove them when the control is disposed (see the dispose and removeEventListener methods).

    Failing to remove event listeners may cause memory leaks.

    The passive parameter is set to false by default, which means the event handler may call event.preventDefault(). If you are adding passive handlers to touch or wheel events, setting this parameter to true will improve application performance.

    For details on passive event listeners, please see Improving scrolling performance with passive listeners.

    Parameters

    • target: EventTarget

      Target element for the event.

    • type: string

      String that specifies the event.

    • fn: any

      Function to execute when the event occurs.

    • Optional capture: boolean

      Whether the listener should be handled by the control before it is handled by the target element.

    • Optional passive: boolean

      Indicates that the handler will never call preventDefault().

    Returns void

applyTemplate

  • applyTemplate(classNames: string, template: string, parts: Object, namePart?: string): HTMLElement
  • Applies the template to a new instance of a control, and returns the root element.

    This method should be called by constructors of templated controls. Therefore, this method is not available. It is responsible for binding the template parts to the corresponding control members.

    For example, the code below applies a template to an instance of an InputNumber control. The template must contain elements with the 'wj-part' attribute set to 'input', 'btn-inc', and 'btn-dec'. The control members '_tbx', '_btnUp', and '_btnDn' will be assigned references to these elements.

    this.applyTemplate('wj-control wj-inputnumber', templateString, {
      _tbx: 'input',
      _btnUp: 'btn-inc',
      _btnDn: 'btn-dec'
    }, 'input');

    @param classNames Names of classes to add to the control's host element. @param template An HTML string that defines the control template. @param parts A dictionary of part variables and their names. @param namePart Name of the part to be named after the host element. This determines how the control submits data when used in forms.

    Parameters

    • classNames: string
    • template: string
    • parts: Object
    • Optional namePart: string

    Returns HTMLElement

beginUpdate

  • beginUpdate(): void

containsFocus

  • containsFocus(): boolean
  • Checks whether this control contains the focused element.

    Returns boolean

create

  • Creates and commits an item in the current CollectionView.

    The CollectionView must implement IEditableCollectionView, allow new items, and have no active add or edit transaction. The values are assigned as top-level properties to the item returned by CollectionView.addNew. When values are omitted, the CollectionView-created item is committed without additional assignments.

    const result = scheduler.create({
        subject: 'Planning',
        start: new Date(2026, 6, 23, 9),
        end: new Date(2026, 6, 23, 10)
    });
    

    Type parameters

    • T

    Parameters

    • Optional values: Partial<T>

      Optional initial field values for the new source item.

    Returns SchedulerItemChangeResult<T>

    A result containing the success status and the newly created source item when the operation succeeds.

deferUpdate

  • deferUpdate(fn: Function): void
  • Executes a function within a beginUpdate/endUpdate block.

    The control will not be updated until the function has been executed. This method ensures endUpdate is called even if the function throws an exception.

    Parameters

    • fn: Function

      Function to be executed.

    Returns void

dispose

  • dispose(): void
  • Releases event handlers, child controls, and other resources owned by the Scheduler.

    Returns void

endUpdate

  • endUpdate(shouldInvalidate?: boolean): void
  • Resumes notifications suspended by calls to beginUpdate.

    Parameters

    • Optional shouldInvalidate: boolean

      should invalidate the control. Default value for this parameter is true.

    Returns void

execute

  • Executes one create, update, or remove request against the current editable CollectionView.

    Create requests use SchedulerItemChangeRequest.values. Update requests require an SchedulerItemChangeRequest.item from the current CollectionView source and may include values to assign. Remove requests require the source item to remove.

    The method raises itemChanging before changing an item and raises itemChanged after a successful operation. Errors thrown by item-change event handlers are not converted into result objects.

    const result = scheduler.execute({
        action: SchedulerItemChangeAction.Update,
        item,
        values: { subject: 'Updated' }
    });
    

    Type parameters

    • T

    Parameters

    Returns SchedulerItemChangeResult<T>

    A result containing the action, success status, and any associated item or conflict details.

focus

  • focus(): void
  • Sets the focus to this control.

    Returns void

getEvents

  • Gets source items that satisfy the specified event query conditions.

    The result is a new array containing the original CollectionView item references, not {@link SchedulerEventInstance} objects. Each source item appears at most once even when the Scheduler renders it across multiple date or resource sections. A returned item can therefore be passed directly to update or remove without reading a sourceItem property.

    The query uses the current filtered, sorted, and paged CollectionView items in view order. Supplied time and resource conditions are combined with AND. Omitting a parameter leaves that dimension unrestricted. Invalid dates, reversed or empty time ranges, unknown resource fields, and empty requested resource values return no matches.

    const meetings = scheduler.getEvents(start, end, resources);
    

    Type parameters

    • T

    Parameters

    • Optional start: Date

      Inclusive lower bound of the queried time range. An event matches when its configured end value is later than start.

    • Optional end: Date

      Exclusive upper bound of the queried time range. An event matches when its configured start value is earlier than end.

    • Optional resources: SchedulerResourceQuery[]

      Resource conditions that an event must all satisfy.

    Returns T[]

    A new array of original CollectionView item references that satisfy every condition.

getTemplate

  • getTemplate(): string
  • Gets the HTML template used to create instances of the control.

    This method traverses up the class hierarchy to find the nearest ancestor that specifies a control template. For example, if you specify a prototype for the ComboBox control, which does not specify a template, it will override the template defined by the DropDown base class (the nearest ancestor that does specify a template).

    Returns string

hasOwnProperty

  • hasOwnProperty(v: PropertyKey): boolean
  • Determines whether an object has a property with the specified name.

    Parameters

    • v: PropertyKey

      A property name.

    Returns boolean

hitTest

  • Gets a SchedulerHitTestInfo object with information about the specified point.

    Parameters

    • pt: number | Point | MouseEvent | HTMLElement

      The point to investigate, in page coordinates, or a MouseEvent object, HTMLElement, or the x coordinate of the point.

    • Optional y: number

      The Y coordinate of the point, used when the first parameter is a number.

    Returns SchedulerHitTestInfo

    A SchedulerHitTestInfo object with information about the point.

initialize

  • initialize(options: any): void
  • Initializes the control by copying the properties from a given object.

    This method allows you to initialize controls using plain data objects instead of setting the value of each property in code.

    For example:

    grid.initialize({
      itemsSource: myList,
      autoGenerateColumns: false,
      columns: [
        { binding: 'id', header: 'Code', width: 130 },
        { binding: 'name', header: 'Name', width: 60 }
      ]
    });
    
    // is equivalent to
    grid.itemsSource = myList;
    grid.autoGenerateColumns = false;
    // etc.

    The initialization data is type-checked as it is applied. If the initialization object contains unknown property names or invalid data types, this method will throw.

    Parameters

    • options: any

      Object that contains the initialization data.

    Returns void

invalidate

  • invalidate(fullUpdate?: boolean): void
  • Invalidates the control causing an asynchronous refresh.

    Parameters

    • Optional fullUpdate: boolean

      Whether to update the control layout as well as the content.

    Returns void

isPrototypeOf

  • isPrototypeOf(v: Object): boolean
  • Determines whether an object exists in another object's prototype chain.

    Parameters

    • v: Object

      Another object whose prototype chain is to be checked.

    Returns boolean

next

  • next(): void
  • Moves the active view forward by one interval defined by the current layout.

    Returns void

onDefinitionChanged

onDisplayDateChanged

onGotFocus

onInvalidInput

onItemsSourceChanged

onItemsSourceChanging

onLostFocus

onRefreshed

onRefreshing

onResourcesChanged

  • Raises the resourcesChanged event.

    Parameters

    • Optional e: EventArgs

      Event arguments supplied to event handlers.

    Returns void

previous

  • previous(): void
  • Moves the active view backward by one interval defined by the current layout.

    Returns void

propertyIsEnumerable

  • propertyIsEnumerable(v: PropertyKey): boolean
  • Determines whether a specified property is enumerable.

    Parameters

    • v: PropertyKey

      A property name.

    Returns boolean

queryEvents

  • queryEvents<T>(query: Object): T[]
  • Gets source items accepted by a caller-provided query.

    The query receives each original item in the complete CollectionView sourceCollection once, including items excluded by the current filter or page. The result preserves source order and contains the original item references, so returned items can be passed directly to update or remove. Errors thrown by the query propagate to the caller.

    const confirmed = scheduler.queryEvents(
        item => item.status === 'confirmed' && item.ownerId === 10
    );
    

    Type parameters

    • T

    Parameters

    • query: Object

      A callback that returns true for source items to include in the result.

    Returns T[]

    A new array containing every source item accepted by the query.

refresh

  • refresh(fullUpdate?: boolean): void
  • Rebuilds the Scheduler presentation model and renders the current view.

    Parameters

    • Optional fullUpdate: boolean

      Whether to perform a full control update. The default value is true.

    Returns void

remove

  • Removes an existing source item from the current CollectionView.

    The item must be the same object reference stored in sourceCollection. Values returned by getEvents satisfy this requirement and can be passed directly to this method; they do not need a sourceItem property. Removing a source item removes every rendered placement of it.

    The CollectionView must implement IEditableCollectionView, allow removal, and have no active add or edit transaction.

    const matches = scheduler.getEvents(start, end, [
        { fieldExpr: 'ownerId', value: 10 }
    ]);
    if (matches.length === 1) {
        scheduler.remove(matches[0]);
    }
    

    Type parameters

    • T

    Parameters

    • item: T

      The original item reference from the current CollectionView sourceCollection.

    Returns SchedulerItemChangeResult<T>

    A result containing the success status and the source item associated with the removal.

removeEventListener

  • removeEventListener(target?: EventTarget, type?: string, fn?: any, capture?: boolean): number
  • Removes one or more event listeners attached to elements owned by this Control.

    Parameters

    • Optional target: EventTarget

      Target element for the event. If null, removes listeners attached to all targets.

    • Optional type: string

      String that specifies the event. If null, removes listeners attached to all events.

    • Optional fn: any

      Handler to remove. If null, removes all handlers.

    • Optional capture: boolean

      Whether the listener is capturing. If null, removes capturing and non-capturing listeners.

    Returns number

    The number of listeners removed.

toLocaleString

  • toLocaleString(): string
  • Returns a date converted to a string using the current locale.

    Returns string

toString

  • toString(): string
  • Returns a string representation of an object.

    Returns string

today

  • today(): void
  • Navigates the active view to today in the configured timeZone.

    Returns void

update

  • Applies values to an existing source item and commits the CollectionView edit transaction.

    The item must be the same object reference stored in the current CollectionView sourceCollection. A copied object, SchedulerEventInstance, or item from another CollectionView is rejected. Items excluded from the current filtered or paged view may still be updated when their original reference is obtained from queryEvents.

    Values are assigned as top-level properties. Updating one source item updates every rendered placement of that item, including placements shown across multiple date or resource sections. The CollectionView must allow an edit to begin and must not have another active transaction.

    const item = scheduler.queryEvents(event => event.subject === 'Planning')[0];
    if (item) {
        scheduler.update(item, { subject: 'Updated Planning' });
    }
    

    Type parameters

    • T

    Parameters

    • item: T

      The original item reference from the current CollectionView sourceCollection.

    • Optional values: Partial<T>

      Optional field values to assign before committing the edit.

    Returns SchedulerItemChangeResult<T>

    A result containing the success status and the source item associated with the update.

valueOf

  • valueOf(): Object
  • Returns the primitive value of the specified object.

    Returns Object

Static disposeAll

  • disposeAll(e?: HTMLElement): void
  • Disposes of all Wijmo controls contained in an HTML element.

    Parameters

    • Optional e: HTMLElement

      Container element.

    Returns void

Static getControl

  • getControl(element: any): Control
  • Gets the control that is hosted in a given DOM element.

    Parameters

    • element: any

      The DOM element that hosts the control, or a CSS selector for the host element (e.g. '#theCtrl').

    Returns Control

Static invalidateAll

  • invalidateAll(e?: HTMLElement): void
  • Invalidates all Wijmo controls contained in an HTML element.

    Use this method when your application has dynamic panels that change the control's visibility or dimensions. For example, splitters, accordions, and tab controls usually change the visibility of its content elements. In this case, failing to notify the controls contained in the element may cause them to stop working properly.

    If this happens, you must handle the appropriate event in the dynamic container and call the Control.invalidateAll method so the contained Wijmo controls will update their layout information properly.

    Parameters

    • Optional e: HTMLElement

      Container element. If set to null, all Wijmo controls on the page will be invalidated.

    Returns void

Static refreshAll

  • refreshAll(e?: HTMLElement): void
  • Refreshes all Wijmo controls contained in an HTML element.

    This method is similar to invalidateAll, except the controls are updated immediately rather than after an interval.

    Parameters

    • Optional e: HTMLElement

      Container element. If set to null, all Wijmo controls on the page will be invalidated.

    Returns void

Events

conflictChecked

Occurs after a create or update candidate is checked for conflicts and before the item change proceeds. Set SchedulerConflictCheckedEventArgs.cancel to true to cancel the pending operation.

definitionChanged

definitionChanged: Event<FlexScheduler, EventArgs>

Occurs after the definition property changes.

displayDateChanged

displayDateChanged: Event<FlexScheduler, EventArgs>

Occurs after the displayDate property changes.

gotFocus

gotFocus: Event<Control, EventArgs>

Occurs when the control gets the focus.

invalidInput

invalidInput: Event<Control, CancelEventArgs>

Occurs when invalid input is detected.

Invalid input may occur when the user types or pastes a value that cannot be converted to the proper type, or a value that is outside the valid range.

If the event handler cancels the event, the control will retain the invalid content and the focus, so users can correct the error.

If the event is not canceled, the control will ignore the invalid input and will retain the original content.

itemChanged

Occurs after an item-change request has completed successfully.

itemChanging

Occurs before an item-change request changes the CollectionView. Set SchedulerItemChangeEventArgs.cancel to true to cancel the request.

itemsSourceChanged

itemsSourceChanged: Event<FlexScheduler, EventArgs>

Occurs after the itemsSource property changes.

itemsSourceChanging

itemsSourceChanging: Event<FlexScheduler, CancelEventArgs>

Occurs before the itemsSource property changes.

lostFocus

lostFocus: Event<Control, EventArgs>

Occurs when the control loses the focus.

refreshed

refreshed: Event<Control, EventArgs>

Occurs after the control has refreshed its contents.

refreshing

refreshing: Event<Control, EventArgs>

Occurs when the control is about to refresh its contents.

resourcesChanged

resourcesChanged: Event<FlexScheduler, EventArgs>

Occurs after the resources property changes.