[ribbon.component.html]
<ej-ribbon id="Default" width="500px" applicationTab.type="menu"applicationTab.menuItemID="ribbonmenu" (groupClick)="CreateNew($event)"> //Initialize the “groupClick” event
<e-tabs>
<e-tab id="home" text="HOME" [groups]="Group1"></e-tab>
</e-tabs>
</ej-ribbon>
<ul id="ribbonmenu">
<li>
<a>FILE </a>
<ul>
<li><a>New</a></li>
<li><a>Open</a></li>
</ul>
</li>
</ul>
[ribbon.component.ts]
CreateNew(args) { //Define the “groupClick” event and add new ribbon tab
$('#Default').data('ejRibbon').addTab("Tab2", this.Group2, 2);
}
Group1 = [{
text: "Group1",
alignType: "rows",
content: [{
groups: [{
id: "grp1",
text: "Click button",
toolTip: "Group1 button"
}],
defaults: {
type: "button",
}
}]
}]
Group2 = [{
text: "Group2",
alignType: "rows",
content: [{
groups: [{
id: "grp2",
text: "Group2 button",
toolTip: "Group2 button"
}],
defaults: {
type: "button",
}
}]
}]
|
[ribbon.component.html]
<ej-ribbon id="Default" width="500px" applicationTab.type="menu" applicationTab.menuItemID="ribbonmenu" (groupClick)="CreateNew($event)"> //Initialize the “groupClick” event
<e-tabs>
<e-tab id="home" text="HOME" [groups]="Group1"></e-tab>
</e-tabs>
</ej-ribbon>
[ribbon.component.ts]
CreateNew(args) { // ‘args’ holds details/information of clicked target. So, you can have multiple group click events for different groups and buttons in different groups.
alert("Clicked target ID( " +args.target.id + " ) retrieved through 'group click' event.");
} |
[ribbon.component.ts]
Group1 = [{
text: "Group1",
alignType: "rows",
content: [{
groups: [{
id: "grp1_btn",
text: "Click grp1 button",
toolTip: "Group1 button",
buttonSettings: {
click: function(args){
alert("button ID( " +args.target.id + " ) retrieved through 'button' event.");
}
}
}],
defaults: {
type: "button",
}
}]
},{
text: "Group2",
alignType: "rows",
content: [{
groups: [{
id: "grp2_btn",
text: "Click grp2 button",
toolTip: "Group2 button",
buttonSettings: {
click: function(args){
alert("button ID( " +args.target.id + " ) retrieved through 'button' event.");
}
}
}],
defaults: {
type: "button",
}
}]
}] |