0 results found

tinymce.ui.ListBox

Contribute to this page
Namespacetinymce.ui
ClassListBox
InheritanceListBox Control
SubclassesNativeListBox

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.

Example

Public Properties

PropertyDefined By
items : Array : Array of ListBox items.ListBox

Public Methods

MethodDefined By
ListBox(id:String, s:Object, ed:Editor) : Constructs a new listbox control instance.ListBox
add(n:String, v:String, o:Object):void : Adds a option item to the list box.ListBox
destroy():void : Destroys the ListBox i.ListBox
getLength(Number:Number):void : Returns the number of items inside the list box.ListBox
hideMenu():void : Hides the drop menu.ListBox
isActive():Boolean : Returns true/false if the control is disabled or not.Control
isDisabled():Boolean : Returns true/false if the control is disabled or not.Control
isRendered():Boolean : Returns true/false if the control has been rendered or not.Control
postRender():void : Post render event.ListBox
remove():void : Removes the control.Control
renderHTML():String : Renders the list box as a HTML string.ListBox
renderMenu():void : Renders the menu to the DOM.ListBox
renderTo(n:Element):void : Renders the control to the specified container element.Control
select(va:String/function):void : Selects a item/option by value.ListBox
selectByIndex(idx:String):void : Selects a item/option by index.ListBox
setActive(s:Boolean):void : Sets the activated state for the control.Control
setDisabled(s:Boolean):void : Sets the disabled state for the control.Control
setState(c:String, s:Boolean):void : Sets the specified class state for the control.Control
showMenu():void : Displays the drop menu with all items.ListBox

Public Events

EventDefined By
onAdd() : Fires when a new item is added.ListBox
onChange() : Fires when the selection has been changed.ListBox
onPostRender() : Fires after the element has been rendered to DOM.ListBox
onRenderMenu() : Fires when the menu gets rendered.ListBox

Property details

items

public items : Array
Array of ListBox items.

Method details

ListBox

public function ListBox(id:String, s:Object, ed:Editor)
Constructs a new listbox control instance.

Parameters

ParamDetail
id:StringControl id for the list box.
s:ObjectOptional name/value settings object.
ed:EditorOptional the editor instance this button is for.

add

public function add(n:String, v:String, o:Object):void
Adds a option item to the list box.

Parameters

ParamDetail
n:StringTitle for the new option.
v:StringValue for the new option.
o:ObjectOptional object with settings like for example class.

destroy

public function destroy():void
Destroys the ListBox i.e. clear memory and events.

getLength

public function getLength(Number:Number):void
Returns the number of items inside the list box.

Parameters

ParamDetail
Number:Numberof items inside the list box.

hideMenu

public function hideMenu():void
Hides the drop menu.

postRender

public function postRender():void
Post render event. This will be executed after the control has been rendered and can be used to set states, add events to the control etc. It's recommended for subclasses of the control to call this method by using this.parent().

renderHTML

public function renderHTML():String
Renders the list box as a HTML string. This method is much faster than using the DOM and when creating a whole toolbar with buttons it does make a lot of difference.

Returns
String - HTML for the list box control element.

renderMenu

public function renderMenu():void
Renders the menu to the DOM.

select

public function select(va:String/function):void
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.

Parameters

ParamDetail
va:String/functionValue to look for inside the list box or a function selector.

selectByIndex

public function selectByIndex(idx:String):void
Selects a item/option by index. This will both add a visual selection to the item and change the title of the control to the title of the option.

Parameters

ParamDetail
idx:StringIndex to select, pass -1 to select menu/title of select box.

showMenu

public function showMenu():void
Displays the drop menu with all items.

Event details

onAdd

public event onAdd()
Fires when a new item is added.

onChange

public event onChange()
Fires when the selection has been changed.

onPostRender

public event onPostRender()
Fires after the element has been rendered to DOM.

onRenderMenu

public event onRenderMenu()
Fires when the menu gets rendered.

Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.