v7.3.0
SupportExamplesFree Trial

TimeAxisHeaderMenu
Feature

Adds scheduler specific menu items to the timeline header context menu.

targetElement.innerHTML = '<p>Right click the timeline header to display its context menu:</p>'; const scheduler = new Scheduler({ appendTo : targetElement, // makes scheduler as high as it needs to be to fit rows autoHeight : true, features : { timeAxisHeaderMenu : { extraItems : [ { text : 'Zoom to fit', weight : 200, icon : 'fa fa-fw fa-arrows-alt', cls : 'b-separator', onItem({ item }) { scheduler.zoomToFit(); } }, { text : 'Custom item', weight : 201, icon : 'fa fa-fw fa-cog', onItem({ item }) { Toast.show('You clicked a Custom item'); } } ] } }, 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 : 'Interview', startDate : '2018-05-07', endDate : '2018-05-10' }, { id : 2, resourceId : 2, name : 'Meeting', startDate : '2018-05-10', endDate : '2018-05-12' }, { id : 3, resourceId : 2, name : 'Future task', startDate : '2018-06-10', endDate : '2018-06-12' } ] });

Default time axis header menu items

Here is the list of menu items provided by this and other features:

Reference Text Weight Feature Description
eventsFilter Filter tasks 100 EventFilter Submenu for event filtering
>nameFilter By name 110 EventFilter Filter by name
Removed when a mode of a Calendar
zoomLevel Zoom 200 This feature Submenu for timeline zooming
>zoomSlider - 210 This feature Changes current zoom level
dateRange Date range 300 This feature Submenu for timeline range
setRange Time range 300 Only added when a mode of a Calendar Sets the Scheduler'srange
Replaces the Date range menu item
>startDateField Start date 310 This feature Start date for the timeline
>endDateField End date 320 This feature End date for the timeline
>leftShiftBtn < 330 This feature Shift backward
>todayBtn Today 340 This feature Go to today
>rightShiftBtn > 350 This feature Shift forward
currentTimeLine Show current timeline 400 TimeRanges Show current time line
>
first level of submenu

Customizing the menu items

The menu items in the TimeAxis Header menu can be customized, existing items can be changed or removed, and new items can be added. This is handled using the items config of the feature.

Add extra items:

const scheduler = new Scheduler({
    features : {
        timeAxisHeaderMenu : {
            items : {
                extraItem : {
                    text : 'Extra',
                    icon : 'fa fa-fw fa-flag',
                    onItem() {
                        ...
                    }
                }
            }
        }
    }
});

Remove existing items:

const scheduler = new Scheduler({
    features : {
        timeAxisHeaderMenu : {
            items : {
                zoomLevel : false
            }
        }
    }
});

Customize existing item:

const scheduler = new Scheduler({
    features : {
        timeAxisHeaderMenu : {
            items : {
                zoomLevel : {
                    text : 'Scale'
                }
            }
        }
    }
});

Customizing submenu items:

const scheduler = new Scheduler({
     features : {
         timeAxisHeaderMenu : {
             items : {
                 dateRange : {
                     menu : {
                         items : {
                             todayBtn : {
                                 text : 'Now'
                             }
                         }
                     }
                 }
             }
         }
     }
});

Manipulate existing items:

const scheduler = new Scheduler({
    features : {
        timeAxisHeaderMenu : {
            // Process items before menu is shown
            processItems({ items }) {
                 // Add an extra item dynamically
                items.coolItem = {
                    text : 'Cool action',
                    onItem() {
                          // ...
                    }
                }
            }
        }
    }
});
The `processItems` implementation my be an `async` function which `awaits` a result to mutate the `items` object.

Full information of the menu customization can be found in the "Customizing the Event menu, the Schedule menu, and the TimeAxisHeader menu" guide.

Video guides

This feature is enabled by default

Useful configs and functions

Member Description
items Menu items configuration object
timeAxisHeaderMenuBeforeShow Fires before menu is shown
timeAxisHeaderMenuItem Fires when item is clicked
timeAxisHeaderMenuShow Fires after menu is shown

See also

No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • A CSS selector targeting an element, such as an ellipsis icon that when clicked will trigger the menu to show.

  • A config which will be applied when creating the Menu component.

    Has a corresponding runtime menu property.

  • Set to true to prevent the native menu from showing when there are no menu items to show, or you manually prevent the menu from showing in an event listener.

    Has a corresponding runtime preventNativeMenu property.

  • triggerEvent : 'contextmenu'/'click'/'dblclick'/null
    HeaderMenu

    Event which is used to show context menu. Available options are: 'contextmenu', 'click' and 'dblclick'. Default value is used from contextMenuTriggerEvent

  • This is a type of the context menu used to generate correct names for methods and events. Should be in camel case. Required to be set in subclass.

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

  • See Keyboard shortcuts for details

  • The widget which this plugin is to attach to.

    Has a corresponding runtime client property.

  • Set to false to disable localization of this object.

Properties

Properties are getters/setters or publicly accessible variables on this class
  • 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.
  • isTimeAxisHeaderMenu : Booleantrue
    READONLY
    static
    ADVANCED
    Identifies an object as an instance of TimeAxisHeaderMenu class, or subclass thereof.
  • properties : Object
    internal
    static
    HeaderMenu

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

  • emptyArray : Array
    internal
    READONLY
    HeaderMenu

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

  • emptyObject : Object
    internal
    READONLY
    HeaderMenu

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

  • isContextMenuBase : Booleantrue
    READONLY
    ADVANCED
    HeaderMenu
    Identifies an object as an instance of ContextMenuBase class, or subclass thereof.
  • isHeaderMenu : Booleantrue
    READONLY
    ADVANCED
    HeaderMenu
    Identifies an object as an instance of HeaderMenu class, or subclass thereof.
  • isInstancePlugin : Booleantrue
    READONLY
    ADVANCED
    HeaderMenu
    Identifies an object as an instance of InstancePlugin class, or subclass thereof.
  • isTimeAxisHeaderMenu : Booleantrue
    READONLY
    ADVANCED
    Identifies an object as an instance of TimeAxisHeaderMenu class, or subclass thereof.
  • baseItems : Object[]
    internal
    READONLY
    HeaderMenu

    Returns the base, configured-in menu items set from the configured items, taking into account the namedItems the feature offers.

  • menu : Menu
    READONLY
    HeaderMenu

    Gets the Menu instance that this feature is using.

    Has a corresponding menu config.

  • An informational object containing contextual information about the last activation of the context menu. The base properties are listed below. Some subclasses may add extra contextual information such as eventRecord and resourceRecord to the block.

  • Set to true to prevent the native menu from showing when there are no menu items to show, or you manually prevent the menu from showing in an event listener.

    Has a corresponding preventNativeMenu config.

  • config : Object
    READONLY
    ADVANCED
    HeaderMenu

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

  • isConstructing : Boolean
    READONLY
    ADVANCED
    HeaderMenu

    This property is set to true before the constructor returns.

  • isDestroying : Boolean
    READONLY
    ADVANCED
    HeaderMenu

    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
    HeaderMenu

    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

Functions

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

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

  • initClass( )
    static
    ADVANCED
    HeaderMenu

    Registers this class type with its Factory

  • Hides the context menu

  • 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: timeAxisHeaderMenu

Source path

Scheduler/feature/TimeAxisHeaderMenu.js

Demo

examples/basic

Contents