| layout | post |
|---|---|
| title | Properties, Methods and Events of ejMenu Widget |
| description | API reference for ejMenu |
| documentation | API |
| platform | js-api |
| keywords | Menu, ejMenu, syncfusion, Menu api |
The Menu control supports displaying a Menu created from list items. The Menu is based on a hierarchy of UL and LI elements where the list items are rendered as sub-menu items.
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; constructor() {
this.data = [
{ id: 1, text: 'Mail', parentId: null },
{ id: 2, text: 'Calender', parentId: null },
{ id: 3, text: 'Notes', parentId: null },
{ id: 4, text: 'Contacts', parentId: null },
// first level child
{ id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' },
{ id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' },
{ id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' },
{ id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' },
{ id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' },
{ id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' },
{ id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' },
{ id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' },
{ id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' },
{ id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' },
{ id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' },
{ id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' },
{ id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' },
{ id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' },
{ id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' },
// second level child
{ id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' },
{ id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' },
{ id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' },
{ id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' },
{ id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' }
];
this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
-
module:jQuery
-
module:jquery.easing.1.3.min.js
-
module:ej.core.js
-
module:ej.data.js
-
module:ej.menu.js
-
module:ej.checkbox.js
{:#members:animationtype}
To enable or disable the Animation while hover or click an menu items.See AnimationType
| Name | Type | Default | Description |
|---|---|---|---|
| Default | string | default | Used to set AnimationType as Default |
| None | string | none | Used to set AnimationType as None |
- ej.AnimationType.Default
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; constructor() {
this.data = [
{ id: 1, text: 'Mail', parentId: null },
{ id: 2, text: 'Calender', parentId: null },
{ id: 3, text: 'Notes', parentId: null },
{ id: 4, text: 'Contacts', parentId: null },
// first level child
{ id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' },
{ id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' },
{ id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' },
{ id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' },
{ id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' },
{ id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' },
{ id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' },
{ id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' },
{ id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' },
{ id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' },
{ id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' },
{ id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' },
{ id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' },
{ id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' },
{ id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' },
// second level child
{ id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' },
{ id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' },
{ id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' },
{ id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' },
{ id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' }
];
this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:contextmenutarget}
Specifies the target id of context menu. On right clicking the specified contextTarget element, context menu gets shown.
- null
{% highlight html %}
<div id="target" class="textarea">
HTML is written in the form of HTML elements consisting of tags enclosed in angle
brackets (like <html>),within the web page content. HTML tags most commonly come in pairs like and ,although
some tags, known as empty elements, are unpaired, for example
<img>. The purpose of a web browser is to read HTML documents and compose them into
visible or audible web pages. The browser does not display the HTML tags, but uses
the tags to interpret the content of the page.
</div>
<ej-menu id="contextMenu" [menuType]="type" [contextMenuTarget]="target" [fields.dataSource]="data">
{% endhighlight %}
{% highlight html %}
import {Component} from '@angular/core';
import {ViewEncapsulation} from '@angular/core';
@Component({
selector: 'sd-home',
templateUrl: 'app/components/menu/menu.component.html',
styleUrls: ['app/components/menu/menu.component.css'],
encapsulation: ViewEncapsulation.None
})
export class MenuComponent {
type: any;
data: array;
target: any;
constructor() {
this.type = ej.MenuType.ContextMenu;
this.data = [
{ id: 1, text: "Cut" },
{ id: 2, text: "Copy" },
{ id: 3, text: "Paste" },
{ id: 4, text: "Comments" },
{ id: 5, text: "Links" },
{ id: 6, text: "Clear Formatting" }
];
this.target = "#target";
}
}
{% endhighlight %}
Add the following code in menu.component.css file.
{% highlight html %}
.textarea {
border: 1px solid;
padding: 10px;
position: relative;
text-align: justify;
width: 463px;
color: gray;
margin: 0 auto;
}
{% endhighlight %}
{:#members:container}
Specifies the container element selectors for submenu’s collision. The submenu gets displayed based on spacing available with respect to container element.
- null
{% highlight html %}
{% endhighlight %}
{% highlight html %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './template.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class TemplateComponent { container: string;
constructor() { this.container = "#menu_controls"; } }
{% endhighlight %}
{:#members:cssclass}
Specify the CSS class to achieve custom theme.
- ""
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; constructor() {
this.data = [
{ id: 1, text: 'Mail', parentId: null },
{ id: 2, text: 'Calender', parentId: null },
{ id: 3, text: 'Notes', parentId: null },
{ id: 4, text: 'Contacts', parentId: null },
// first level child
{ id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' },
{ id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' },
{ id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' },
{ id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' },
{ id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' },
{ id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' },
{ id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' },
{ id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' },
{ id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' },
{ id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' },
{ id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' },
{ id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' },
{ id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' },
{ id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' },
{ id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' },
// second level child
{ id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' },
{ id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' },
{ id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' },
{ id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' },
{ id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' }
];
this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:enableanimation}
To enable or disable the Animation effect while hover or click an menu items.
- true
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:enablecenteralign}
Specifies the root menu items to be aligned center in horizontal menu.
- false
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:enabled}
Enable / Disable the Menu control.
- true
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:enablertl}
Specifies the menu items to be displayed in right to left direction.
- false
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:enableseparator}
When this property sets to false, the menu items is displayed without any separators.
- true
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:excludetarget}
Specifies the target which needs to be excluded. i.e., The context menu will not be displayed in those specified targets.
- null
{% highlight html %}
<div id="target" class="textarea">
HTML is written in the form of HTML elements consisting of tags enclosed in angle
brackets (like <html>),within the web page content. HTML tags most commonly come in pairs like and ,although
some tags, known as empty elements, are unpaired, for example
<img>. The purpose of a web browser is to read HTML documents and compose them into
visible or audible web pages. The browser does not display the HTML tags, but uses
the tags to interpret the content of the page.
<div class="inner">
Context Menu will not be displayed here !!
</div>
</div>
<ej-menu id="contextMenu" [menuType]="type" [contextMenuTarget]="target" [fields.dataSource]="data" excludeTarget=".inner">
{% endhighlight %}
{% highlight html %}
import {Component} from '@angular/core';
import {ViewEncapsulation} from '@angular/core';
@Component({
selector: 'sd-home',
templateUrl: 'app/components/menu/menu.component.html',
styleUrls: ['app/components/menu/menu.component.css'],
encapsulation: ViewEncapsulation.None
})
export class MenuComponent {
type: any;
data: array;
target: any;
constructor() {
this.type = ej.MenuType.ContextMenu;
this.data = [
{ id: 1, text: "Cut" },
{ id: 2, text: "Copy" },
{ id: 3, text: "Paste" },
{ id: 4, text: "Comments" },
{ id: 5, text: "Links" },
{ id: 6, text: "Clear Formatting" }
];
this.target = "#target";
}
}
{% endhighlight %}
{:#members:fields}
Fields used to bind the data source and it includes following field members to make data bind easier.
- null
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:fields-child}
It receives the child data for the inner level.
{:#members:fields-datasource}
It receives datasource as Essential DataManager object and JSON object.
{:#members:fields-htmlattribute}
Specifies the HTML attributes to “LI” item list.
{:#members:fields-id}
Specifies the id to menu items list
{:#members:fields-imageattribute}
Specifies the image attribute to “img” tag inside items list.
{:#members:fields-imageurl}
Specifies the image URL to “img” tag inside item list.
{:#members:fields-linkattribute}
Adds custom attributes like "target" to the anchor tag of the menu items.
{:#members:fields-parentid}
Specifies the parent id of the table.
{:#members:fields-query}
It receives query to retrieve data from the table (query is same as SQL).
{:#members:fields-spritecssclass}
Specifies the sprite CSS class to “LI” item list.
{:#members:fields-tablename}
It receives table name to execute query on the corresponding table.
{:#members:fields-text}
Specifies the text of menu items list.
{:#members:fields-url}
Specifies the URL to the anchor tag in menu item list.
{:#members:height}
Specifies the height of the root menu.
- "auto"
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:htmlattributes}
Specifies the list of HTML attributes to be added to menu control.
- {}
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; htmlattributes: any;
constructor() { this.enableAnimation = true; this.htmlattributes = {"aria-label":"menu"}; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
}
}
{% endhighlight %}
{:#members:isresponsive}
Enables/disables responsive support for the Menu control during the window resizing time.
- true
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:menutype}
Specifies the type of the menu. Essential JavaScript Menu consists of two type of menu, they are Normal Menu and Context Menu mode.See MenuType
| Name | Type | Default | Description |
|---|---|---|---|
| ContextMenu | string | contextmenu | Used to set MenuType as ContextMenu |
| NormalMenu | string | normal menu | Used to set MenuType as NormalMenu |
- ej.MenuType.NormalMenu
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:openonclick}
Specifies the sub menu items to be show or open only on click.
- false
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:orientation}
Specifies the orientation of normal menu. Normal menu can rendered in horizontal or vertical direction by using this API. See Orientation
| Name | Type | Default | Description |
|---|---|---|---|
| Horizontal | string | horizontal | Used to set Orientation as Horizontal |
| Vertical | string | vertical | Used to set Orientation as Vertical |
- ej.Orientation.Horizontal
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:showRootLevelArrows}
Specifies the main menu items arrows only to be shown if it contains child items.
- true
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:showsublevelarrows}
Specifies the sub menu items arrows only to be shown if it contains child items.
- true
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:submenudirection}
Specifies position of pull down submenu that will appear on mouse over.See Direction
| Name | Type | Default | Description |
|---|---|---|---|
| Left | string | left | Used to set Direction as Left |
| None | string | none | Used to set Direction as None |
| Right | string | right | Used to set Direction as Right |
- ej.Direction.Right
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:titletext}
Specifies the title to responsive menu.
- "Menu"
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:width}
Specifies the width of the main menu.
- auto
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:overflowHeight}
Specifies the popup menu height.
- auto
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#members:overflowWidth}
Specifies the popup menu width.
- auto
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} }
{% endhighlight %}
{:#methods:disable}
Disables the Menu control.
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
var obj = $("#menu").data("ejMenu");
obj.disable();
} }
{% endhighlight %}
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
$("#menu").ejMenu("disable");
} }
{% endhighlight %}
{:#methods:disableitem}
Specifies the Menu Item to be disabled by using the Menu Item Text.
| Name | Type | Description |
|---|---|---|
| itemtext | string | Specifies the Menu Item Text to be disabled. |
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
var obj = $("#menu").data("ejMenu");
obj.disableItem("Mail");
} }
{% endhighlight %}
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
$("#menu").ejMenu("disableItem","Mail");
} }
{% endhighlight %}
{:#methods:disableitembyid}
Specifies the Menu Item to be disabled by using the Menu Item Id.
| Name | Type | Description |
|---|---|---|
| itemid | string|number | Specifies the Menu Item id to be disabled |
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
var obj = $("#menu").data("ejMenu");
obj.disableItem(1);
} }
{% endhighlight %}
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
$("#menu").ejMenu("disableItemByID","1");
} }
{% endhighlight %}
{:#methods:enable}
Enables the Menu control.
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
var obj = $("#menu").data("ejMenu");
obj.enable();
} }
{% endhighlight %}
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
$("#menu").ejMenu("enable");
} }
{% endhighlight %}
{:#methods:enableitem}
Specifies the Menu Item to be enabled by using the Menu Item Text.
| Name | Type | Description |
|---|---|---|
| itemtext | string | Specifies the Menu Item Text to be enabled. |
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
var obj = $("#menu").data("ejMenu");
obj.enableItem("Mail");
} }
{% endhighlight %}
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
$("#menu").ejMenu("enableItem","Mail");
} }
{% endhighlight %}
{:#methods:enableitembyid}
Specifies the Menu Item to be enabled by using the Menu Item Id.
| Name | Type | Description |
|---|---|---|
| itemid | string|number | Specifies the Menu Item id to be enabled. |
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
var obj = $("#menu").data("ejMenu");
obj.enableItem(1);
} }
{% endhighlight %}
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
$("#menu").ejMenu("enableItemByID","1");
} }
{% endhighlight %}
{:#methods:hide}
Hides the Context Menu control.
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
var obj = $("#menu").data("ejMenu");
obj.hide();
} }
{% endhighlight %}
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
$("#menu").ejMenu("hide");
} }
{% endhighlight %}
{:#methods:hideItems}
Hides the specific items in Menu control.
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
var obj = $("#menu").data("ejMenu");
obj.hideItems(["#1","#2"]);
} }
{% endhighlight %}
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
$("#menu").ejMenu("hideItems","#1");
} }
{% endhighlight %}
{:#methods:insert}
Insert the menu item as child of target node.
| Name | Type | Description |
|---|---|---|
| item | Object | Information about Menu item. |
| target | string|Object | Selector of target node or Object of target node. |
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
var obj = $("#menu").data("ejMenu");
obj.insert([{ id: "More", text: "More" }], "#1");
} }
{% endhighlight %}
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
$("#menu").ejMenu("insert", [{ id: "More", text: "More" }], "#1");
} }
{% endhighlight %}
{:#methods:insertafter}
Insert the menu item after the target node.
| Name | Type | Description |
|---|---|---|
| item | Object | Information about Menu item. |
| target | string|Object | Selector of target node or Object of target node. |
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
var obj = $("#menu").data("ejMenu");
obj.insertAfter([{ id: "More", text: "More" }], "#1");
} }
{% endhighlight %}
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
$("#menu").ejMenu("insertAfter", [{ id: "More", text: "More" }], "#1");
} }
{% endhighlight %}
{:#methods:insertbefore}
Insert the menu item before the target node.
| Name | Type | Description |
|---|---|---|
| item | Object | Information about Menu item. |
| target | string|Object | Selector of target node or Object of target node. |
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
var obj = $("#menu").data("ejMenu");
obj.insertBefore([{ id: "More", text: "More" }], "#1");
} }
{% endhighlight %}
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
$("#menu").ejMenu("insertBefore", [{ id: "More", text: "More" }], "#1");
} }
{% endhighlight %}
{:#methods:remove}
Remove Menu item.
| Name | Type | Description |
|---|---|---|
| target | object|array | Selector of target node or Object of target node. |
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
var obj = $("#menu").data("ejMenu");
obj.remove(["#1"]);
} }
{% endhighlight %}
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
$("#menu").ejMenu("remove",["#1"]);
} }
{% endhighlight %}
{:#methods:show}
To show the Menu control.
| Name | Type | Description |
|---|---|---|
| locationX | number | x co-ordinate position of context menu. |
| locationY | number | y co-ordinate position of context menu. |
| targetElement | object | target element |
| event | object | name of the event |
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} create(){
$("#menu").ejMenu("hide");
} OnClick(){
var obj = $("#menu").data("ejMenu");
obj.show();
} }
{% endhighlight %}
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} create(){
$("#menu").ejMenu("hide");
} OnClick(){
$("#menu").ejMenu("show");
} }
{% endhighlight %}
{:#methods:showItems}
Show the specific items in Menu control.
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} create(){
$("#menu").ejMenu("hide");
} OnClick(){
var obj = $("#menu").data("ejMenu");
obj.showItems(["#1","#2"]);
} }
{% endhighlight %}
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} create(){
$("#menu").ejMenu("hide");
} OnClick(){
$("#menu").ejMenu("showItems",["#1","#2"]);
} }
{% endhighlight %}
{:#events:beforeopen}
Fires before context menu gets open.
| Name | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| argument | Object | Event parameters from context menu
|
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} beforeOpen(args){
} }
{% endhighlight %}
{:#events:click}
Fires when mouse click on menu items.
| Name | Type | Description | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| argument | Object | Event parameters from menu
|
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(args){
} }
{% endhighlight %}
{:#events:close}
Fire when context menu on close.
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| argument | Object | Event parameters from menu
|
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} Close(args){
} }
{% endhighlight %}
{:#events:open}
Fires when context menu on open.
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| argument | Object | Event parameters from menu
|
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} Open(args){
} }
{% endhighlight %}
{:#events:create}
Fires to create menu items.
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| argument | Object | Event parameters from menu
|
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} create(args){
} }
{% endhighlight %}
{:#events:destroy}
Fires to destroy menu items.
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| argument | Object | Event parameters from menu
|
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} OnClick(){
$("#menu").ejMenu("destroy");
} destroy(args){
} }
{% endhighlight %}
{:#events:keydown}
Fires when key down on menu items.
| Name | Type | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| argument | Object | Event parameters from menu
|
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} keydown(args){
} }
{% endhighlight %}
{:#events:mouseout}
Fires when mouse out from menu items.
| Name | Type | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| argument | Object | Event parameters from menu
|
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} mouseOut(args){
} }
{% endhighlight %}
{:#events:mouseover}
Fires when mouse over the Menu items.
| Name | Type | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| argument | Object | Event parameters from menu
|
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} mouseOver(args){
} }
{% endhighlight %}
{:#events:overflowOpen}
Fires when overflow popup menu opens.
| Name | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| argument | Object | Event parameters from menu
|
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} overflowOpen(args){
} }
{% endhighlight %}
{:#events:overflowClose}
Fires when overflow popup menu closes.
| Name | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| argument | Object | Event parameters from menu
|
{% highlight html %}
{% endhighlight %}
{% highlight ts %}
import { Component } from '@angular/core'; import { ViewEncapsulation } from '@angular/core';
@Component({ selector: 'ej-app', templateUrl: './default.component.html', styleUrls: ['./menu.component.css'], encapsulation: ViewEncapsulation.None, }) export class DefaultComponent{
data: Array; fieldsvalues: Object; enableAnimation: boolean; constructor() { this.enableAnimation = true; this.data = [ { id: 1, text: 'Mail', parentId: null }, { id: 2, text: 'Calender', parentId: null }, { id: 3, text: 'Notes', parentId: null }, { id: 4, text: 'Contacts', parentId: null }, // first level child { id: 11, parentId: 1, text: 'Inbox', sprite: 'mailicon sprite-inbox' }, { id: 12, parentId: 1, text: 'Drafts', sprite: 'mailicon sprite-drafts' }, { id: 13, parentId: 1, text: 'Sent items', sprite: 'mailicon sprite-sentitems' }, { id: 14, parentId: 1, text: 'Deleted', sprite: 'mailicon sprite-deleted' }, { id: 15, parentId: 1, text: 'Junk mails', sprite: 'mailicon sprite-junk' }, { id: 16, parentId: 1, text: 'Personal', sprite: 'mailicon sprite-folders' }, { id: 17, parentId: 2, text: 'My Calender', sprite: 'mailicon sprite-calendar' }, { id: 18, parentId: 2, text: 'Team', sprite: 'mailicon sprite-calendar' }, { id: 19, parentId: 2, text: 'Others', sprite: 'mailicon sprite-calendar' }, { id: 20, parentId: 3, text: 'My Reference', sprite: 'mailicon sprite-folder' }, { id: 21, parentId: 3, text: 'Team Meeting', sprite: 'mailicon sprite-folder' }, { id: 22, parentId: 3, text: 'Others', sprite: 'mailicon sprite-folder' }, { id: 23, parentId: 4, text: 'Suggested', sprite: 'mailicon sprite-contacts' }, { id: 24, parentId: 4, text: 'My Team', sprite: 'mailicon sprite-contacts' }, { id: 25, parentId: 4, text: 'Others', sprite: 'mailicon sprite-contacts' }, // second level child { id: 111, parentId: 11, text: 'Development', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'Supports', sprite: 'mailicon sprite-folders' }, { id: 111, parentId: 11, text: 'HR Team', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Support Template', sprite: 'mailicon sprite-folders' }, { id: 112, parentId: 12, text: 'Personal', sprite: 'mailicon sprite-folders' } ]; this.fieldsvalues = { dataSource: this.data, parentId: 'parentId', id: 'id', text: 'text', spriteCssClass: 'sprite' };
} overflowClose(args){
} }
{% endhighlight %}