DayPilot.Menu.items

Holds an array of menu items.

Example of an event menu:

menu.items = [
{text:'Open', onclick: function() { var e = this.source; var command = this.item.command; alert('Opening event (id ' + e.value() +')'); } },
{text:'Send', onclick: function() { var e = this.source; var command = this.item.command; alert('Sending event (id ' + e.value() +')'); } },
{text:'-' },  // separator
{text:'Delete (CallBack)', command: 'Delete', action: 'CallBack' },
{text:'Delete (PostBack)', command: 'Delete', action: 'PostBack' },
{text:'Open Google', href: 'http://www.google.com/?q={0}' }];

Menu Item Structure

The menu item object has the following properties:

  • text (required): The menu item text to be displayed. Use "-" to show a separator.
  • href (optional): The URL to be opened on menu item click. The "{0}" string will be replaced with the event id.
  • onclick (optional): JavaScript function to be called on menu item click. The menu source object (event or time range) is stored in this.source, the menu item can be accessed using this.item.
  • command (optional): The command to be invoked on the server side (EventMenuClick or TimeRangeMenuClick event)
  • action (optional): Method of invoking the menu item command on the server side: "CallBack" or "PostBack" ("CallBack" is the default value)
  • disabled (optional): If set to true the menu item will be marked as disabled with "*_item_disabled" CSS class and no action will be fired on click (since version 8.0.1591)
  • image (optional): URL of the menu item icon
  • cssClass (optional): Custom CSS class that will be added to the menu item (since version 8.2.3146)

Only one type of menu click action is invoked. The order of processing is as follows:

  • href
  • onclick
  • command

Menu item examples

JavaScript action

{text:'Open', onclick: function() { var e = this.source; var command = this.item.command; alert('Opening event (id ' + e.value() +')'); } }

Separator

{text:'-' }

Server-side action invoked using CallBack

{text:'Delete (CallBack)', command: 'Delete', action: 'CallBack' }

Server-side action invoked using PostBack (ASP.NET only)

{text:'Delete (PostBack)', command: 'Delete', action: 'PostBack' }

URL

{text:'Open Google', href: 'http://www.google.com/?q={0}' }

DayPilot for JavaScript, ASP.NET WebForms, ASP.NET MVC, Java