tinymce.ui.ListBox

Inheritance
Subclasses NativeListBox
This class is used to create list boxes/select list. This one will generate a non native control. This one has the benefits of having visual items added.

Examples

// Creates a new plugin class and a custom listbox
tinymce.create('tinymce.plugins.ExamplePlugin', {
    createControl: function(n, cm) {
        switch (n) {
            case 'mylistbox':
                var mlb = cm.createListBox('mylistbox', {
                     title : 'My list box',
                     onselect : function(v) {
                         tinyMCE.activeEditor.windowManager.alert('Value selected:' + v);
                     }
                });

                // Add some values to the list box
                mlb.add('Some item 1', 'val1');
                mlb.add('some item 2', 'val2');
                mlb.add('some item 3', 'val3');

                // Return the new listbox instance
                return mlb;
        }

        return null;
    }
});

// Register plugin with a short name
tinymce.PluginManager.add('example', tinymce.plugins.ExamplePlugin);

// Initialize TinyMCE with the new plugin and button
tinyMCE.init({
   ...
   plugins : '-example', // - means TinyMCE will not try to load it
   theme_advanced_buttons1 : 'mylistbox' // Add the new example listbox to the toolbar
});

Properties

Property Defined By
Array of ListBox items.
tinymce.ui.ListBox

Events

Event Defined By
Fires when the selection has been changed.
tinymce.ui.ListBox
Fires after the element has been rendered to DOM.
tinymce.ui.ListBox
Fires when a new item is added.
tinymce.ui.ListBox
Fires when the menu gets rendered.
tinymce.ui.ListBox

Methods

Method Defined By
Constructs a new listbox control instance.
tinymce.ui.ListBox
Selects a item/option by value.
tinymce.ui.ListBox
Selects a item/option by index.
tinymce.ui.ListBox
Adds a option item to the list box.
tinymce.ui.ListBox
Returns the number of items inside the list box.
tinymce.ui.ListBox
Renders the list box as a HTML string.
tinymce.ui.ListBox
Displays the drop menu with all items.
tinymce.ui.ListBox
Hides the drop menu.
tinymce.ui.ListBox
Renders the menu to the DOM.
tinymce.ui.ListBox
Post render event.
tinymce.ui.ListBox
Destroys the ListBox i.
tinymce.ui.ListBox
Sets the disabled state for the control.
tinymce.ui.Control
Returns true/false if the control is disabled or not.
tinymce.ui.Control
Sets the activated state for the control.
tinymce.ui.Control
Returns true/false if the control is disabled or not.
tinymce.ui.Control
Sets the specified class state for the control.
tinymce.ui.Control
Returns true/false if the control has been rendered or not.
tinymce.ui.Control
Renders the control to the specified container element.
tinymce.ui.Control
Removes the control.
tinymce.ui.Control