Any OOjs UI widget that contains other widgets (such as buttons or options) mixes in GroupElement. Adding, removing, and clearing items from the group is done through the interface the class provides. For more information, please see the OOjs UI documentation on MediaWiki.
- Mixes In:
- OO.EmitterList
- Source:
Methods
addItems(items, indexopt)
Add items to the group.
Items will be added to the end of the group array unless the optional index
parameter specifies
a different insertion point. Adding an existing item will move it to the end of the array or the point specified by the index
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
items |
Array.<OO.ui.Element> | An array of items to add to the group |
|
index |
number |
<optional> |
Index of the insertion point |
- Source:
clearItems()
Clear all items from the group.
Cleared items are detached from the DOM, not removed, so that they may be reused. To remove only a subset of items from a group, use the #removeItems method.
- Source:
findItemFromData(data) → {OO.ui.Element|null}
Find an item by its data.
Only the first item with matching data will be returned. To return all matching items, use the #findItemsFromData method.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | Item data to search for |
- Source:
Returns:
Item with equivalent data, null
if none exists
- Type
- OO.ui.Element | null
findItemsFromData(data) → {Array.<OO.ui.Element>}
Find items by their data.
All items with matching data will be returned. To return only the first match, use the #findItemFromData method instead.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | Item data to search for |
- Source:
Returns:
Items with equivalent data
- Type
- Array.<OO.ui.Element>
getItemFromData(data) → {OO.ui.Element|null}
Get an item by its data.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | Item data to search for |
- Deprecated:
- Since v0.25.0; use #findItemFromData instead.
- Source:
Returns:
Item with equivalent data, null
if none exists
- Type
- OO.ui.Element | null
getItemsFromData(data) → {Array.<OO.ui.Element>}
Find items by their data.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | Item data to search for |
- Deprecated:
- Since v0.25.0; use #findItemsFromData instead.
- Source:
Returns:
Items with equivalent data
- Type
- Array.<OO.ui.Element>
insertItem()
- Source:
moveItem()
- Source:
removeItems(items)
Remove the specified items from a group.
Removed items are detached (not removed) from the DOM so that they may be reused. To remove all items from a group, you may wish to use the #clearItems method instead.
Parameters:
Name | Type | Description |
---|---|---|
items |
Array.<OO.ui.Element> | An array of items to remove |
- Source:
setGroupElement($group)
Set the group element.
If an element is already set, items will be moved to the new element.
Parameters:
Name | Type | Description |
---|---|---|
$group |
jQuery | Element to use as group |
- Source: