Class: InstanceManager

InstanceManager


new InstanceManager()

For each Panel Component there is a component which manages the instances of that panel. That component is called InstanceManager and this class provides the functionality of that component. If the panel is repeatable then there can be multiple instances of that panel, otherwise there will be only one instance. The InstanceManager provides API to retrieve, create and remove the instances.

One can retrieve the instanceManager object by using the instanceManager property of the Panel

Since:
  • 6.0

Extends

Members


<readonly, non-null> name :string

Name of the node

Type:
  • string
Since:
  • 6.0
Inherited From:

<readonly, non-null> somExpression :string

SOM Expression of the Node.

In Adaptive Forms SOM is a model to access fields and Panels. The SOM Expression provides easy access to the Fields and Objects through a straightforward syntax

Type:
  • string
Since:
  • 6.0
Inherited From:
Example
Considering the heirarchy,
-- guide
  -- panel1
  ---- field2
  ---- panel2
  ------ field3
the som Expression of field3 will be guide[0].panel1[0].panel2[0].field3[0]. The 0 here represents
the same name sibling index of that particular item in its parent. If panel2 has an additional child field3 as
  ---- panel2
  ------- field3
  ------- field3
The second field3 would have the somExpression guide[0].panel1[0].panel2[0].field3[1]

<readonly, nullable> title :string

Title of the element, localized as per the locale of the form.

Returns the localized version of the title. In case of Fields it is the Caption of the Field.

Type:
  • string
Since:
  • 6.0
Inherited From:

<readonly, nullable> nonLocalizedTitle :string

Non Localized Title of the element.

Type:
  • string
Since:
  • 6.0
Inherited From:

<readonly, non-null> panel :Panel

Parent panel in which the Node is inserted

Type:
Since:
  • 6.0
Inherited From:

<readonly, non-null> index :number

Index of the Node among its siblings having the same name as itself

Every node in the Adaptive Form field has an index depending on the number of same named siblings that the node has before it. If the element has no same named sibling its index will always be 0.

Type:
  • number
Since:
  • 6.0
Inherited From:

<readonly> visible :boolean

Visiblity of the Node. true if it's visible otherwise false.

The API always returns true. It is configurable only for components extending from Scriptable interface.

Type:
  • boolean
Since:
  • 6.0
Inherited From:

<readonly> enabled :boolean

Specify whether the component is enabled or not.

The API always returns true. It is configurable only for components extending from Scriptable interface.

Type:
  • boolean
Since:
  • 6.0
Inherited From:

<readonly> minOccur :Number

Minimum number of instances the panel managed by this object can have

Specifies the minimum number of times the Panel will be repeated. This can be set through the Panel Dialog. If the value is set greater than 1, the panel will be repeated at least that many times. Negative values are ignored

Type:
  • Number
Since:
  • 6.0
See:

<readonly> maxOccur :Number

Maximum number of instances the panel managed by this object can have

Specifies the maximum number of times the Panel being managed can be repeated. This can be set through the Panel Dialog. If the value is set greater than 1, the panel can be repeated at most that many times. Negative values are ignored

Type:
  • Number
Since:
  • 6.0
See:

<readonly> instanceCount :number

The number of instances of the panel that is managed by this object

Type:
  • number
Since:
  • 6.0

<readonly> repeatable :Boolean

Specifies if the panel is repeatable or not

A Panel is considered repeatable if the value of minOccur property is strictly less than maxOccur

Type:
  • Boolean
Since:
  • 6.0
See:

<readonly> instances :Array.<Panel>

Instance of the panel

Type:
Since:
  • 6.0

Methods


visit(callback, context)

Executes a callback on the element and its children.

The callback is called for the element and all its children.

Parameters:
Name Type Description
callback GuideNode~VisitorCallback
context Object

this parameter to be used

Since:
  • 6.0
Inherited From:

addInstance()

Creates a new instance of the panel and appends it at after the last instance.

A new instance of the panel is created only if the current number of instances are less than as specified by maxOccur property.

Since:
  • 6.0
Returns:

the new Panel, if one gets created otherwise null.

Type
Panel

insertInstance(nIndex)

Creates a new instance of the panel and appends it at the specified index.

A new instance of the panel is created only if the current number of instances or the index provided are less than as specified by maxOccur property

Parameters:
Name Type Description
nIndex number

index where to add the new panel

Since:
  • 6.0
Returns:

the new Panel object, if one gets created, null otherwise.

Type
Panel

removeInstance(nIndex)

Removes an instance of the panel at the specified index

The panel instance is removed only if the current number of instances or the index provided are greater than as specified by minOccur property

Parameters:
Name Type Description
nIndex number

index of the panel instance to remove. It must be a valid integer. ie. minOccur<index<maxOccur

Since:
  • 6.0

addInstances(instancesConfig, addedXfaInstances)

create multiple instances appending one after the other.

Adding multiple instances based on instance count. This will trigger the deepSync events only when all the instances will be added. Avoid using it when you want to trigger events for each instances being added.

Parameters:
Name Type Description
instancesConfig Object

contains configuration

Properties
Name Type Description
instanceCount number

no of instances to add

addedXfaInstances
Since:
  • 6.5