MultiBrick Class
The MultiBrick prototype. Used as a container for multiple independent Bricks if they are required to be displayed side by side. To instantiate, call new on the MultiBrick prototype.
Imports RAMP Modules:
Uses RAMP Templates:
templates/bricks_template.json
Item Index
Properties
Events
Methods
clear
()
MultiBrick
chainable
Clears the MultiBrick by clearing of the individual bricks inside the MultiBrick using their specific clear methods.
Returns:
itself
disable
-
disable
-
force
Disables or re-enables the Brick.
Parameters:
Returns:
itself
displayNotice
-
notice
-
[noticeTemplate]
Display a (error) notice on the brick.
Parameters:
Returns:
itself
getData
-
[wrap]
Returns MultiBrick's data by mixing together data of the individual bricks inside using their specific getData methods and then passing it to the Brick's getData method for potential wrapping.
Parameters:
-
[wrap]
Boolean optionalindicates of the payload should be wrapped with a Brick's id; useful when collection information from several Bricks at once.
Returns:
MultiBrick's data
isValid
()
Boolean
Checks if the MultiBrick is valid. It's valid only if all individual bricks inside it are valid.
Returns:
true if valid; false if not
new
-
id
-
config
Initializes the MutliBrick by generating a specified template and setting defaults.
Parameters:
-
id
Stringspecified id of the MultiBrick
-
config
Objecta configuration object for the MultiBrick
-
[content]
String optionala collection of bricks to be displayed in the MultiBrick
-
[header]
String optionala Brick header
-
[instructions]
String optionala configuration object for the Brick
-
[required]
Array | Object optionalcollection of rules specifying what external conditions must be valid for the Brick to be enabled
-
[freezeStates]
Array optionala set of rules specifying states Brick should be frozen
-
[baseTemplate]
String optionala base template name to be used
-
[noticeTemplate]
String optionala notice template name to be used
-
[containerClass]
String optionala CSS class of the specific brick container
-
[template]
String optionala name of the specific Brick template
-
notify
-
eventName
-
data
Notifies a listener of a Brick event.
Parameters:
Returns:
itself
on
-
eventName
-
listener
Sets a listener on the Brick for a specified eventName.
Parameters:
Returns:
itself
setData
-
data
Sets MultiBrick's data by setting data to the individual bricks inside it. Uses their own specific setData functions. *
Parameters:
-
data
Object
Returns:
itself
setState
-
state
Sets the state of the MultiBrick by setting states of the individual bricks inside the MultiBrick using their specific setState methods.
Parameters:
-
state
Stringa name of the state to set
Returns:
itself
Properties
_isFrozen
Boolean
private
Indicates if the Brick is frozen and cannot be interacted with.
Default: false
_listeners
Object
private
A collection of listeners to be notified of specified Brick events.
Default: {}
containerClass
String
private
A CSS class of the MultiBrick container node.
Default: "multi-brick-container"
content
Array
private
A collection of Brick objects to be displayed side by side in the MultiBrick.
Default: []
freezeStates
Array
private
A set of rules specifying states Brick should be frozen.
Default: []
Example:
[
Bricks.Brick.state.SUCCESS,
Bricks.Brick.state.ERROR
],
required
Array
A collection of rules specifying what external conditions must be valid for the Brick to be enabled. This is not used directly by the Brick itself, but instead by the external object manipulating a collection of Bricks. Two types of rules possible: "all" and "any". Any additional properties needed can be specified.
Default: null
Example:
[
{
type: "all",
check: ["serviceType", "serviceURL"]
}
]
state
Object
A dictionary of Brick events.
Example:
state: {
SUCCESS: "brick/success",
ERROR: "brick/error",
DEFAULT: "brick/default"
}
template
String
private
A name of the default MultiBrick template.
Default: "default_multi_brick_template"
Events
Bricks.Brick.event.CHANGE
Published whenever a Brick undergoes some change.
Event Payload:
-
data
Objectanything, usually result of calling getData() on the Brick