Author API Methods
createItemGroup()
Creates an Item group within a random Activity, allowing for organized grouping of Items.
You would want to use this method so that you can programmatically create a new Item group in a random Activity or create a custom button to do this in your application.
Examples
// Creates a random Item group with a default label.
authorApp.createItemGroup();
// Creates either a random or fixed Item group.
authorApp.createItemGroup({ type: 'random' });
authorApp.createItemGroup({ type: 'fixed' });
// Creates either a random or fixed Item group with a custom label.
authorApp.createItemGroup({ type: 'random', label: 'Random Item Group' });
authorApp.createItemGroup({ type: 'fixed', label: 'Fixed Item Group' });
Arguments
-
options object
Additional parameters to define the Item group.
-
type string
Specifies the type of Item group.
Default:
"random"
Possible values
"fixed"
"random"
-
label string
A custom label for the Item group. If not provided, a default name will be generated based on the type. For example:
- If the type is
"random"
, the default name will be "Random Item group 1", "Random Item group 2", etc. - If the type is
"fixed"
, the default name will be "Fixed Item group 1", "Fixed Item group 2", etc.
- If the type is
-
Return value
Type boolean
Returns true
if an Item group is successfully created, or false
if an Item group cannot be created. A false
value is returned in the following cases:
- The author is not in the random Activity editor view, or
- The provided options object is invalid, or
options.type
is neither"random"
nor"fixed"
, oroptions.label
is not valid, or- The maximum group limit for Item groups has been reached.