IItemGroup
Defined in: core/items/igroup.ts:43
Methods
Section titled “Methods”addItems()
Section titled “addItems()”addItems(
itemArray):Promise<IItemGroup>
Defined in: core/items/igroup.ts:87
param: (items: string || string[] || Item || Item[])
return: Promise<Item[]>Adds items into the group. Accepts an item ID or Item object or an array of those. Rejects when any of the provided items cannot be added into the group, such as, but not limited to already added into the group or another group, in another scene, or non-existent
var myItems;Scene.getItems().then(function(items) { // assuming myItems[0] is the group Item // can be added as a single Item object myItems[0].addItems(myItems[2]); // or via the item's id myItems[0].addItems(myItems[3]._id); // or via an array of them myItems[0].addItems([myItems[4],myItems[5]]);});Parameters
Section titled “Parameters”itemArray
Section titled “itemArray”any
Returns
Section titled “Returns”Promise<IItemGroup>
getItems()
Section titled “getItems()”getItems():
Promise<Item[]>
Defined in: core/items/igroup.ts:57
return: Promise<Item[]>
Get all the items present in the group
grpItem.getItems().then(function(items) { // do something to each item in items array});Returns
Section titled “Returns”Promise<Item[]>
removeItems()
Section titled “removeItems()”removeItems(
itemArray):Promise<IItemGroup>
Defined in: core/items/igroup.ts:117
param: (items: string || string[] || Item || Item[])
return: Promise<Item[]>Removes the items from the group. This doesn’t actually remove the item from the scene, but only detaches itself from the group. Accepts an item ID or Item object or an array of those. Rejects when any of the provided items cannot be removed from the group,
var myItems;Scene.getItems().then(function(items) { // assuming myItems[0] is the group Item // can remove a single Item object myItems[0].removeItems(myItems[2]); // or via the item's id myItems[0].removeItems(myItems[3]._id); // or via an array of them myItems[0].removeItems([myItems[4],myItems[5]]);});Parameters
Section titled “Parameters”itemArray
Section titled “itemArray”any
Returns
Section titled “Returns”Promise<IItemGroup>
unGroup()
Section titled “unGroup()”unGroup():
Promise<IItemGroup>
Defined in: core/items/igroup.ts:141
return: Promise<Item[]>
Removes all the items within the group. This doesn’t actually remove the items from the scene, but only detaches itself from the group. This also persists the group item in the scene. You would need to specifically remove the GroupItem if needed.
Scene.getItems().then(function(items) { if (myItems[0] instanceof XJS.GroupItem) { return myItems[0].unGroup(); }}).then(function() { myItems[0].remove()});Returns
Section titled “Returns”Promise<IItemGroup>