Skip to main content

Section class

📖 Description​

The Section class represents a section 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​

Branches


🏷️ hasBranches​

Retrieves if the section has any branches.

Type​

boolean


🏷️ id​

Retrieves the identifier of the section.

Type​

string


🏷️ index​

Retrieves the zero-based index of the section in the Sections collection.

Type​

number


🏷️ isFirst​

Retrieves if the section is the first section in the Sections collection.

Type​

boolean


🏷️ isLast​

Retrieves if the section is the last section in the Sections collection.

Type​

boolean


🏷️ isMoving​

Retrieves if the section is being moved (dragged) in the builder.

Type​

boolean


🏷️ isReadonly​

Sets or retrieves if the nested branch (subform) is read-only.

Type​

boolean

tip

See the Subforms guide for more information.


🏷️ isRendered​

Retrieves if the section is rendered by the builder.

Type​

boolean


🏷️ jumps​

Retrieves a list of branches which have a jump to this section.

Type​

Branch[]


🏷️ name​

Sets or retrieves the name of the section.

Type​

string


🏷️ nodes​

Retrieves the collection of child nodes.

Type​

Nodes


🏷️ parent​

Retrieves a reference to parent Sections collection.

Type​

Sections


🏷️ predecessor​

Retrieves a reference to the predecessor Section (if any).

Type​

Section | 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

tip

See the Subforms guide for more information.


🏷️ successor​

Retrieves a reference to the successor Section (if any).

Type​

Section | undefined


🏷️ type​

Retrieves the section type, which can be one of the following values:

  • section: The section is a regular section;
  • branch: The section serves as a branch;
  • nest: The section holds a nested branch (subform).

Type​

"section" | "branch" | "nest"


🏷️ version​

Sets or retrieves a version indicator for a section 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

tip

See the Subforms guide for more information.

▶️ Methods​


🔧 convertToBranch​

Converts a section to a branch.

Signature​

convertToBranch(): boolean

Return value​

Returns true if the conversion was successfully.


🔧 convertToSection​

Convert a (nested) section back to a regular section.

Signature​

convertToSection(): boolean

Return value​

Returns true if the conversion was successfully.


🔧 convertToNestedBranch​

Converts a section to a nested branch.

Signature​

convertToNestedBranch(): void

🔧 delete​

Deletes a section from the Sections collection.

Signature​

delete(): this

Return value​

Returns a reference to the deleted Section.


🔧 duplicate​

Duplicates the section.

Signature​

duplicate(): Section

Return value​

Returns a reference to the duplicated Section.


🔧 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 section after this section.

Signature​

insertAfter(): Section

Return value​

Returns a reference to the new Section.


🔧 insertBefore​

Inserts a new section before this section.

Signature​

insertBefore(): Section

Return value​

Returns a reference to the new Section.


🔧 insertBranchAfter​

Inserts a new branch section after this section.

Signature​

insertBranchAfter(): [Branch, Section]

Return value​

Returns a reference to the new branch and section.


🔧 insertBranchBefore​

Inserts a new branch section before this section.

Signature​

insertBranchBefore(): [Branch, Section]

Return value​

Returns a reference to the new branch and section.


🔧 insertNestedBranchAfter​

Inserts a new nested branch section after this section.

Signature​

insertNestedBranchAfter(): [Branch, Section]

Return value​

Returns a reference to the new branch and section.


🔧 insertNestedBranchBefore​

Inserts a new nested branch section before this section.

Signature​

insertNestedBranchBefore(): [Branch, Section]

Return value​

Returns a reference to the new branch and section.


🔧 loadNestedBranch​

Loads a nested branch (subform).

info

You can only load nested branches (subforms) to sections of type nest.

Signature​

loadNestedBranch(
definition: IDefinition,
reference?: string,
version?: string,
alias?: string,
readonly?: boolean
): boolean

Parameters​

NameTypeOptionalDescription
definitionIDefinitionNoSpecifies the definition to load as subform.
referencestringYesSpecifies an optional reference to store.
versionstringYesSpecifies an optional version identifier.
aliasstringYesSpecifies an optional alias for the subform.
readonlybooleanYesSpecifies if the subform is read-only.

Return value​

Returns true if the subform was loaded succesfully.

tip

See the Subforms guide for more information.


🔧 moveToIndex​

Moves the section to the specified index.

Signature​

moveToIndex(index: number): boolean

Parameters​

NameTypeOptionalDescription
indexnumberNoSpecifies the new index position for the section where the first section is 0.

Return value​

Returns true if the move succeeded.


🔧 moveToNestedBranch​

Moves the section to a nested branch (subform).

Signature​

moveToNestedBranch(section: Section): boolean

Parameters​

NameTypeOptionalDescription
sectionSectionNoSpecifies the section to move the section to.

Return value​

Returns true if the section was moved succesfully.


🔧 moveToParent​

Moves the section to the parent form if it is in a nested branch (subform).

Signature​

moveToParent(): boolean

Return value​

Returns true if the section was moved succesfully.


🔧 moveUpOrDown​

Moves the section up or down.

Signature​

moveUpOrDown(up: boolean): boolean

Parameters​

NameTypeOptionalDescription
upbooleanNoSpecifies if the move direction is up (true) or down (false).

Return value​

Returns true if the move succeeded.


🔧 rerender​

Invokes a rerendering of the section.

Signature​

rerender(type: "refresh" | "update"): void

Parameters​

NameTypeOptionalDescription
type"refresh" | "update"NoSpecifies 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 section and removes all content in the section.

Signature​

reset(): void

🔧 swap​

Swaps the section with another section.

Signature​

swap(with: Section): boolean

Parameters​

NameTypeOptionalDescription
withSectionNoSpecifies the section to swap with.

Return value​

Returns true if the swap succeeded.