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
Constructor for the collection.
Parameters
- items (Array) - Optional array with items to add.
Methods
active
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
Adds new items to the control collection.
Parameters
- items (Array) - Array if items to add to collection.
Return value
- tinymce.ui.Collection - Current collection instance.
addClass
Adds a class to all items in the collection.
Parameters
- cls (String) - Class to add to each item.
Return value
- tinymce.ui.Collection - Current collection instance.
disabled
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
Executes the specified callback on each item in collection.
Parameters
- callback (function) - Callback to execute for each item in collection.
Return value
- tinymce.ui.Collection - Current collection instance.
eq
Makes the current collection equal to the specified index.
Parameters
- index (Number) - Index of the item to set the collection to.
Return value
- tinymce.ui.Collection - Current collection.
exec
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
- tinymce.ui.Collection - Current collection.
filter
Filters the collection item based on the specified selector expression or selector function.
Parameters
- selector (String) - Selector expression to filter items by.
Return value
- tinymce.ui.Collection - Collection containing the filtered items.
fire
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
- tinymce.ui.Collection - Current collection instance.
hasClass
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
Hides the items in the current collection.
Return value
- tinymce.ui.Collection - Current collection instance.
indexOf
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
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
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
- tinymce.ui.Collection - Current collection instance.
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.
Parameters
- name (String) - Name of the event to bind. For example "click".
- callback (String) - Callback function to execute once the event occurs.
Return value
- tinymce.ui.Collection - Current collection instance.
prop
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
- tinymce.ui.Collection - Current collection instance or value of the first item on a get operation.
remove
Remove all items from collection and DOM.
Return value
- tinymce.ui.Collection - Current collection.
removeClass
Removes the specified class from all items in collection.
Parameters
- cls (String) - Class to remove from each item.
Return value
- tinymce.ui.Collection - Current collection instance.
reverse
Returns a new collection of the contents in reverse order.
Return value
- tinymce.ui.Collection - Collection instance with reversed items.
selected
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
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
- tinymce.ui.Collection - Collection instance.
show
Shows the items in the current collection.
Return value
- tinymce.ui.Collection - Current collection instance.
slice
Slices the items within the collection.
Parameters
- index (Number) - Index to slice at.
- len (Number) - Optional length to slice.
Return value
- tinymce.ui.Collection - Current collection.
text
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
Returns an JavaScript array object of the contents inside the collection.
Return value
- Array - Array with all items from collection.
visible
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.