Sections class
📖 Description
The Sections
class represents a collection of sections in a form definition. Each section in the collection is a Section
instance.
🗃️ Fields
🏷️ all
Retrieves all the sections that are in the collection.
Type
🏷️ count
Retrieves the number of sections in the collection.
Type
number
🏷️ firstItem
Retrieves the first section in the collection.
Type
Section
| undefined
🏷️ lastItem
Retrieves the last section in the collection.
Type
Section
| undefined
▶️ Methods
🔧 each
Iterates through all sections in the collection.
Signature
each(fn: (section: Section) => boolean | void): boolean
Parameters
Name | Type | Optional | Description |
---|---|---|---|
fn | (section: Section ) => boolean | void | No | Function that is called for each section in the collection. If you want to stop the iteration, you can return true from this function to do so. |
Return value
Returns true
if the iteration was stopped (break).
🔧 reverseEach
Iterates through all sections in the collection in reverse direction (starting with the last section).
Signature
reverseEach(fn: (section: Section) => boolean | void): boolean
Parameters
Name | Type | Optional | Description |
---|---|---|---|
fn | (section: Section ) => boolean | void | No | Function that is called for each section in the collection. If you want to stop the iteration, you can return true from this function to do so. |
Return value
Returns true
if the iteration was stopped (break).
🔧 sort
Sorts the sections using the supplied compare function.
Signature
sort(fn: (a: Section, b: Section) => number): boolean
Parameters
Name | Type | Optional | Description |
---|---|---|---|
fn | (a: Section , b: Section ) => boolean | No | Specifies the compare function. The compare function should return a number according to the following rules: - a is less than b return -1;- a is greater than b return 1;- a is equal to b return 0. |
Return value
Returns true
if the sort invoked a section position change.