TINY BLOG > Important changes to Tiny Cloud pricing > Find out more
Return to Tiny.cloud

tinymce.ui.Collection

Control collection, this class contains control instances and it enables you to perform actions on all the contained items. This is very similar to how jQuery works.

Examples

someCollection.show().disabled(true);

Constructors

name summary defined by
Collection() Constructor for the collection. tinymce.ui.Collection

Methods

name summary defined by
active() Sets/gets the active state on the items in the current collection. tinymce.ui.Collection
add() Adds new items to the control collection. tinymce.ui.Collection
addClass() Adds a class to all items in the collection. tinymce.ui.Collection
disabled() Sets/gets the disabled state on the items in the current collection. tinymce.ui.Collection
each() Executes the specified callback on each item in collection. tinymce.ui.Collection
eq() Makes the current collection equal to the specified index. tinymce.ui.Collection
exec() Executes the specific function name with optional arguments an all items in collection if it exists. tinymce.ui.Collection
filter() Filters the collection item based on the specified selector expression or selector function. tinymce.ui.Collection
fire() Fires the specified event by name and arguments on the control. This will execute all bound event handlers. tinymce.ui.Collection
hasClass() Returns true/false if the class exists or not. tinymce.ui.Collection
hide() Hides the items in the current collection. tinymce.ui.Collection
indexOf() Finds the index of the specified control or return -1 if it isn't in the collection. tinymce.ui.Collection
name() Sets/gets the name contents of the items in the current collection. tinymce.ui.Collection
off() Unbinds the specified event and optionally a specific callback. If you omit the name parameter all event handlers will be removed. If you omit the callback all event handles by the specified name will be removed. tinymce.ui.Collection
on() Binds a callback to the specified event. This event can both be native browser events like "click" or custom ones like PostRender. The callback function gets one parameter: either the browser's native event object or a custom JS object. tinymce.ui.Collection
prop() Sets/gets the specific property on the items in the collection. The same as executing control.(); tinymce.ui.Collection
remove() Remove all items from collection and DOM. tinymce.ui.Collection
removeClass() Removes the specified class from all items in collection. tinymce.ui.Collection
reverse() Returns a new collection of the contents in reverse order. tinymce.ui.Collection
selected() Sets/gets the selected state on the items in the current collection. tinymce.ui.Collection
set() Sets the contents of the collection. This will remove any existing items and replace them with the ones specified in the input array. tinymce.ui.Collection
show() Shows the items in the current collection. tinymce.ui.Collection
slice() Slices the items within the collection. tinymce.ui.Collection
text() Sets/gets the text contents of the items in the current collection. tinymce.ui.Collection
toArray() Returns an JavaScript array object of the contents inside the collection. tinymce.ui.Collection
visible() Sets/gets the selected state on the items in the current collection. tinymce.ui.Collection

Constructors

Collection

public constructor function Collection(items:Array)

Constructor for the collection.

Parameters
  • items (Array) - Optional array with items to add.

Methods

active

active():tinymce.ui.Collection

Sets/gets the active state on the items in the current collection.

Return value
  • tinymce.ui.Collection - Current collection instance or active state of the first item on a get operation.

add

add(items:Array):tinymce.ui.Collection

Adds new items to the control collection.

Parameters
  • items (Array) - Array if items to add to collection.
Return value

addClass

addClass(cls:String):tinymce.ui.Collection

Adds a class to all items in the collection.

Parameters
  • cls (String) - Class to add to each item.
Return value

disabled

disabled():tinymce.ui.Collection

Sets/gets the disabled state on the items in the current collection.

Return value
  • tinymce.ui.Collection - Current collection instance or disabled state of the first item on a get operation.

each

each(callback:function):tinymce.ui.Collection

Executes the specified callback on each item in collection.

Parameters
  • callback (function) - Callback to execute for each item in collection.
Return value

eq

eq(index:Number):tinymce.ui.Collection

Makes the current collection equal to the specified index.

Parameters
  • index (Number) - Index of the item to set the collection to.
Return value

exec

exec(name:String, ...:Object):tinymce.ui.Collection

Executes the specific function name with optional arguments an all items in collection if it exists.

Examples
collection.exec("myMethod", arg1, arg2, arg3);
Parameters
  • name (String) - Name of the function to execute.
  • ... (Object) - Multiple arguments to pass to each function.
Return value

filter

filter(selector:String):tinymce.ui.Collection

Filters the collection item based on the specified selector expression or selector function.

Parameters
  • selector (String) - Selector expression to filter items by.
Return value

fire

fire(name:String, args:Object):tinymce.ui.Collection

Fires the specified event by name and arguments on the control. This will execute all bound event handlers.

Parameters
  • name (String) - Name of the event to fire.
  • args (Object) - Optional arguments to pass to the event.
Return value

hasClass

hasClass(cls:String):Boolean

Returns true/false if the class exists or not.

Parameters
  • cls (String) - Class to check for.
Return value
  • Boolean - true/false state if the class exists or not.

hide

hide():tinymce.ui.Collection

Hides the items in the current collection.

Return value

indexOf

indexOf(ctrl:Control):Number

Finds the index of the specified control or return -1 if it isn't in the collection.

Parameters
  • ctrl (Control) - Control instance to look for.
Return value
  • Number - Index of the specified control or -1.

name

name():tinymce.ui.Collection

Sets/gets the name contents of the items in the current collection.

Return value
  • tinymce.ui.Collection - Current collection instance or name value of the first item on a get operation.

off

off(name:String, callback:function):tinymce.ui.Collection

Unbinds the specified event and optionally a specific callback. If you omit the name parameter all event handlers will be removed. If you omit the callback all event handles by the specified name will be removed.

Parameters
  • name (String) - Optional name for the event to unbind.
  • callback (function) - Optional callback function to unbind.
Return value

on

on(name:String, callback:String):tinymce.ui.Collection

Binds a callback to the specified event. This event can both be native browser events like "click" or custom ones like PostRender. The callback function gets one parameter: either the browser's native event object or a custom JS object.

Parameters
  • name (String) - Name of the event to bind. For example "click".
  • callback (String) - Callback function to execute once the event occurs.
Return value

prop

prop(name:String, value:Object):tinymce.ui.Collection

Sets/gets the specific property on the items in the collection. The same as executing control.();

Parameters
  • name (String) - Property name to get/set.
  • value (Object) - Optional object value to set.
Return value

remove

remove():tinymce.ui.Collection

Remove all items from collection and DOM.

Return value

removeClass

removeClass(cls:String):tinymce.ui.Collection

Removes the specified class from all items in collection.

Parameters
  • cls (String) - Class to remove from each item.
Return value

reverse

reverse():tinymce.ui.Collection

Returns a new collection of the contents in reverse order.

Return value

selected

selected():tinymce.ui.Collection

Sets/gets the selected state on the items in the current collection.

Return value
  • tinymce.ui.Collection - Current collection instance or selected state of the first item on a get operation.

set

set(items:Array):tinymce.ui.Collection

Sets the contents of the collection. This will remove any existing items and replace them with the ones specified in the input array.

Parameters
  • items (Array) - Array with items to set into the Collection.
Return value

show

show():tinymce.ui.Collection

Shows the items in the current collection.

Return value

slice

slice(index:Number, len:Number):tinymce.ui.Collection

Slices the items within the collection.

Parameters
  • index (Number) - Index to slice at.
  • len (Number) - Optional length to slice.
Return value

text

text():tinymce.ui.Collection

Sets/gets the text contents of the items in the current collection.

Return value
  • tinymce.ui.Collection - Current collection instance or text value of the first item on a get operation.

toArray

toArray():Array

Returns an JavaScript array object of the contents inside the collection.

Return value
  • Array - Array with all items from collection.

visible

visible():tinymce.ui.Collection

Sets/gets the selected state on the items in the current collection.

Return value
  • tinymce.ui.Collection - Current collection instance or visible state of the first item on a get operation.

Can't find what you're looking for? Let us know.

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.