TinyMCE:API/tinymce.ui.NativeListBox/select

From Moxiecode Documentation Wiki

Jump to: navigation, search

Contents

Method: select

Summary

Selects a item/option by value. This will both add a visual selection to the item and change the title of the control to the title of the option.

Syntax

<void> select(<String/function> v)

Parameters

v
Value to look for inside the list box or a selector function.

Examples

// Selects the example1 item inside the styleselect control of the active editor
tinyMCE.activeEditor.controlManager.get('styleselect').select('example1');

// Selects the an item by a sector function
tinyMCE.activeEditor.controlManager.get('styleselect').select(function(v) {return v == "someval";});

// Select an item in list box based in the class name of the current node
ed.onNodeChange.add(function(ed, cm, n) {
    cm.get('styleselect').select(n.className);
});
Personal tools