setActivity()
Sets the Activity JSON of the Activity being edited.
You would want to use this method so that you can programatically set default values for various settings and content for the current Activity, for example.
Examples
authorApp.setActivity({
"items": [
{
reference: "test1",
organisation_id: 1
},
{
reference: "test3",
organisation_id: 1,
item_pool_id: "pool_1"
}
],
"rendering_type": "inline"
});
Arguments
-
options object
Options for customizing the behavior of the
setActivity()
method.-
extend boolean
When
extend
istrue
, the supplied Activity JSON extends the existing JSON. This means that existing attributes will be overridden and new attributes will be added.When
extend
isfalse
, the supplied Activity JSON completely replaces the existing JSON.Default:
true
-
Return value
booleanReturns true
if successful.
Returns false
if unable to set the Activity JSON, for example, when not in the Activity editor view.
Type definitions
activityJson object
Definition of the Activity JSON.
-
config object
The Items API initialization options. See the Items API initialization options for more information.
-
items array[ItemObject]
An array of ItemObject references to be used in the Activity.
-
rendering_type string
The Items API rendering type for the assessment, which can be rendered inline or using the assessment player.