TinyMCE:API/tinymce.ui.SplitButton

From Moxiecode Documentation Wiki

Jump to: navigation, search

Contents

Class: tinymce.ui.SplitButton extends tinymce.ui.MenuButton

This class is used to create a split button. A button with a menu attached to it. To see this class in action check the Custom listbox/splitbutton example out.

Events

onRenderMenu
Gets dispatched/fired when the menu for the split button needs to be rendered.

Methods

postRender
Post render handler.
renderHTML
Renders the split button as a HTML string.

Methods inherited from tinymce.ui.MenuButton

hideMenu,renderMenu,showMenu

Methods inherited from tinymce.ui.Button

renderHTML,postRender,execCallback

Methods inherited from tinymce.ui.Control

setDisabled,isDisabled,setActive,isActive,setState,isRendered,renderHTML,renderTo,postRender,destroy

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;
    }
});
Personal tools