TinyMCE:API/tinymce.ui.SplitButton/onRenderMenu
From Moxiecode Documentation Wiki
Contents |
[edit]
Event: onRenderMenu
[edit]
Summary
This event gets fired when the SplitBitton need to render the menu in other words when the user clicks the arrow next to the button. You can then fill up the menu with items and possible sub menus on this event.
[edit]
Syntax
<void> onRenderMenu(<tinymce.ui.SplitButton> c, <tinymce.ui.DropMenu> m)
[edit]
Parameters
- c
- Reference to the splitbutton control instance.
- m
- Drop menu instance for the splitbutton.
[edit]
Examples
// Creates a new plugin class and a custom split button
tinymce.create('tinymce.plugins.ExamplePlugin', {
createControl: function(n, cm) {
switch (n) {
case 'mysplitbutton':
var c = cm.createSplitButton('mysplitbutton', {
title : 'My split button',
image : 'some.gif',
onclick : function() {
alert('Button was clicked.');
}
});
c.onRenderMenu.add(function(c, m) {
m.add({title : 'Some title', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
m.add({title : 'Some item 1', onclick : function() {
alert('Some item 1 was clicked.');
}});
m.add({title : 'Some item 2', onclick : function() {
alert('Some item 2 was clicked.');
}});
});
// Return the new splitbutton instance
return c;
}
return null;
}
});
