Cluster class
📖 Description
The Cluster
class represents a cluster (also known as a section in the builder UI) of the form definition in the builder.
🗃️ Fields
🏷️ branch
Retrieves a reference to parent Branch
.
Type
Branch
| undefined
🏷️ branches
Retrieves the collection of child branches.
Type
🏷️ hasBranches
Retrieves if the cluster has any branches.
Type
boolean
🏷️ id
Retrieves the identifier of the cluster.
Type
string
🏷️ index
Retrieves the zero-based index of the cluster in the Clusters
collection.
Type
number
🏷️ isFirst
Retrieves if the cluster is the first cluster in the Clusters
collection.
Type
boolean
🏷️ isLast
Retrieves if the cluster is the last cluster in the Clusters
collection.
Type
boolean
🏷️ isMoving
Retrieves if the cluster is being moved (dragged) in the builder.
Type
boolean
🏷️ isReadonly
Sets or retrieves if the nested branch (subform) is read-only.
Type
boolean
See the Subforms guide for more information.
🏷️ isRendered
Retrieves if the cluster is rendered by the builder.
Type
boolean
🏷️ jumps
Retrieves a list of branches which have a jump to this cluster.
Type
🏷️ name
Sets or retrieves the name of the cluster.
Type
string
🏷️ nodes
Retrieves the collection of child nodes.
Type
🏷️ parent
Retrieves a reference to parent Clusters
collection.
Type
🏷️ predecessor
Retrieves a reference to the predecessor Cluster
(if any).
Type
Cluster
| undefined
🏷️ reference
Sets or retrieves the optional reference for a nested branch (subform). This property can be used to track the origin of a subform when it was loaded from an external source. For example, the identifier of a subform can be stored in this property.
Type
string
See the Subforms guide for more information.
🏷️ successor
Retrieves a reference to the successor Cluster
(if any).
Type
Cluster
| undefined
🏷️ type
Retrieves the cluster type, which can be one of the following values:
cluster
: The cluster is a regular cluster;branch
: The cluster serves as a branch;nest
: The cluster holds a nested branch (subform).
Type
"cluster" | "branch" | "nest"
🏷️ version
Sets or retrieves a version indicator for a cluster that is a nested branch (subform). This property can be used to track the origin of a subform when it was loaded from an external source. For example, the version number of a subform can be stored in this property.
Type
string
See the Subforms guide for more information.
▶️ Methods
🔧 convertToBranch
Converts a cluster to a branch.
Signature
convertToBranch(): boolean
Return value
Returns true
if the conversion was successfully.
🔧 convertToCluster
Convert a (nested) cluster back to a regular cluster.
Signature
convertToCluster(): boolean
Return value
Returns true
if the conversion was successfully.
🔧 convertToNestedBranch
Converts a cluster to a nested branch.
Signature
convertToNestedBranch(): void
🔧 delete
Deletes a cluster from the Clusters
collection.
Signature
delete(): this
Return value
Returns a reference to the deleted Cluster
.
🔧 duplicate
Duplicates the cluster.
Signature
duplicate(): Cluster
Return value
Returns a reference to the duplicated Cluster
.
🔧 extract
Extracts a nested branch to the parent form.
Signature
extract(): boolean
Return value
Returns true
if the subform was extracted successfully.
🔧 insertAfter
Inserts a new cluster after this cluster.
Signature
insertAfter(): Cluster
Return value
Returns a reference to the new Cluster
.
🔧 insertBefore
Inserts a new cluster before this cluster.
Signature
insertBefore(): Cluster
Return value
Returns a reference to the new Cluster
.
🔧 insertBranchAfter
Inserts a new branch cluster after this cluster.
Signature
insertBranchAfter(): [Branch, Cluster]
Return value
Returns a reference to the new branch and cluster.
🔧 insertBranchBefore
Inserts a new branch cluster before this cluster.
Signature
insertBranchBefore(): [Branch, Cluster]
Return value
Returns a reference to the new branch and cluster.
🔧 insertNestedBranchAfter
Inserts a new nested branch cluster after this cluster.
Signature
insertNestedBranchAfter(): [Branch, Cluster]
Return value
Returns a reference to the new branch and cluster.
🔧 insertNestedBranchBefore
Inserts a new nested branch cluster before this cluster.
Signature
insertNestedBranchBefore(): [Branch, Cluster]
Return value
Returns a reference to the new branch and cluster.
🔧 loadNestedBranch
Loads a nested branch (subform).
You can only load nested branches (subforms) to clusters of type nest
.
Signature
loadNestedBranch(
definition: IDefinition,
reference?: string,
version?: string,
alias?: string,
readonly?: boolean
): boolean
Parameters
Name | Type | Optional | Description |
---|---|---|---|
definition | IDefinition | No | Specifies the definition to load as subform. |
reference | string | Yes | Specifies an optional reference to store. |
version | string | Yes | Specifies an optional version identifier. |
alias | string | Yes | Specifies an optional alias for the subform. |
readonly | boolean | Yes | Specifies if the subform is read-only. |
Return value
Returns true
if the subform was loaded succesfully.
See the Subforms guide for more information.
🔧 moveToIndex
Moves the cluster to the specified index.
Signature
moveToIndex(index: number): boolean
Parameters
Name | Type | Optional | Description |
---|---|---|---|
index | number | No | Specifies the new index position for the cluster where the first cluster is 0 . |
Return value
Returns true
if the move succeeded.
🔧 moveToNestedBranch
Moves the cluster to a nested branch (subform).
Signature
moveToNestedBranch(cluster: Cluster): boolean
Parameters
Name | Type | Optional | Description |
---|---|---|---|
cluster | Cluster | No | Specifies the cluster to move the cluster to. |
Return value
Returns true
if the cluster was moved succesfully.
🔧 moveToParent
Moves the cluster to the parent form if it is in a nested branch (subform).
Signature
moveToParent(): boolean
Return value
Returns true
if the cluster was moved succesfully.
🔧 moveUpOrDown
Moves the cluster up or down.
Signature
moveUpOrDown(up: boolean): boolean
Parameters
Name | Type | Optional | Description |
---|---|---|---|
up | boolean | No | Specifies if the move direction is up (true ) or down (false ). |
Return value
Returns true
if the move succeeded.
🔧 rerender
Invokes a rerendering of the cluster.
Signature
rerender(type: "refresh" | "update"): void
Parameters
Name | Type | Optional | Description |
---|---|---|---|
type | "refresh" | "update" | No | Specifies the rerender type. It can be one of the following values: - refresh : Refresh the whole rendering (slower);- update : Updates the rendering (faster). |
🔧 reset
Resets the cluster and removes all content in the cluster.
Signature
reset(): void
🔧 swap
Swaps the cluster with another cluster.
Signature
swap(with: Cluster): boolean
Parameters
Name | Type | Optional | Description |
---|---|---|---|
with | Cluster | No | Specifies the cluster to swap with. |
Return value
Returns true
if the swap succeeded.