controller

Overview

The controller represents a runtime form instance (FormController) and provides methods for manipulating forms programmatically.

It includes properties like enabled, readOnly, and view to control form behavior and appearance, and a variety of methods to manage data, set focus, and control the form’s user interface dynamically.

Functions like find() and search() enable advanced data querying capabilities.

All javascript calls must be delegated to the FormController

Properties Summarized

Type
Name
Summary

Gets or sets the enabled state of a form; also known as "grayed-out".

Gets or sets the read-only state of a form; also known as "editable" Note: The field(s) in a form set as read-only can be selected and the field data can be copied to clipboard.

Get/Set the current type of view of this form.

Methods Summarized

Type
Name
Summary

Set the foundset in find mode.

Sets focus to a field specified by its name.

Sets focus to the first field of the form; based on tab order sequence.

Returns the maximum length allowed in the specified dataprovider.

Gets a value based on the specified dataprovider name.

Get the used datasource.

Returns the state of this form designmode.

Get the design-time properties of the form.

Get a design-time property of a form.

Gets the forms context where it resides, returns a dataset of its structure to the main controller.

Gets the form width in pixels.

Get the name of this form.

Gets the part height in pixels.

Returns the Y offset of a given part of the form.

Gets the current record index of the current foundset.

Get an array with the names of the components that are part of the tab sequence.

Returns the JSWindow that the form is shown in, or null if the form is not currently showing in a window.

Loads all accessible records from the datasource into the form foundset.

Loads a (related) foundset into the form.

Loads a (related) foundset into the form.

Recreates the forms UI components, to reflect the latest solution model.

Start the database search and use the results, returns the number of records, make sure you did "find" function first.

Start the database search and use the results, returns the number of records, make sure you did "find" function first.

Start the database search and use the results, returns the number of records, make sure you did "find" function first.

void

Sets the value based on a specified dataprovider name.

void

Sets this form in designmode with param true, false will return to normal browse/edit mode.

void

Sets this form in designmode with one or more callback methods.

void

Sets this form in designmode with one or more callback methods.

void

Sets this form in designmode with one or more callback methods.

void

Sets this form in designmode with one or more callback methods.

void

Sets this form in designmode with one or more callback methods.

void

Sets this form in designmode with one or more callback methods.

void

Sets the current record index of the current foundset.

void

Set the tab order sequence programatically, by passing the elements references in a javascript array.

void

Shows the form (makes the form visible) This function does not affect the form foundset in any way.

void

Shows the form (makes the form visible) This function does not affect the form foundset in any way.

void

Shows the form (makes the form visible) This function does not affect the form foundset in any way.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

void

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Properties Detailed

enabled

Gets or sets the enabled state of a form; also known as "grayed-out". Notes:

  • A disabled element(s) cannot be selected by clicking the form.

Type Boolean true if the form is enabled (not grayed-out), false otherwise.

Sample

readOnly

Gets or sets the read-only state of a form; also known as "editable"

Note: The field(s) in a form set as read-only can be selected and the field data can be copied to clipboard.

Type Boolean true if the form is read-only (not editable), false otherwise.

Sample

view

Get/Set the current type of view of this form. Can be one of the JSForm.xxxx_VIEW constants. In NGClient only RECORD_VIEW is fully supported, the List and TableViews should be replaced by components.

Type Number the current view type of the form as an integer (e.g., RECORD_VIEW, LIST_VIEW).

Sample

Methods Detailed

find()

Returns: Boolean true if the foundset is now in find mode, false otherwise.

Sample

focusField(fieldName, skipReadonly)

Sets focus to a field specified by its name. If the second parameter is set to true, then readonly fields will be skipped (the focus will be set to the first non-readonly field located after the field with the specified name; the tab sequence is respected when searching for the non-readonly field).

Parameters

  • String fieldName the name of the field to be focussed

  • Boolean skipReadonly indication to skip read only fields, if the named field happens to be read only

Returns: Boolean true if component was found and can be focused

Sample

focusFirstField()

Sets focus to the first field of the form; based on tab order sequence.

Returns: Boolean true if component was found and can be focused

Sample

getDataProviderMaxLength(name)

Returns the maximum length allowed in the specified dataprovider.

Parameters

  • String name the dataprovider name

Returns: Number the length

Sample

getDataProviderValue(dataProvider)

Gets a value based on the specified dataprovider name.

Parameters

  • String dataProvider the dataprovider name to retieve the value for

Returns: Object the dataprovider value (null if unknown dataprovider)

Sample

getDataSource()

Get the used datasource.

Returns: String the datasource

Sample

getDesignMode()

Returns the state of this form designmode.

Returns: Boolean the design mode state (true/fase)

Sample

getDesignProperties()

Get the design-time properties of the form.

Returns: Object a map containing all design-time properties of the form.

Sample

getDesignTimeProperty(key)

Get a design-time property of a form.

Parameters

Returns: Object the value of the specified design-time property, or null if the property is not set.

Sample

getFormContext()

Gets the forms context where it resides, returns a dataset of its structure to the main controller. Note1: can't be called in onload, because no context is yet available at this time. Note2: tabindex is 1 (left) or 2 (right) for a SplitPane and 0 based for the other tabpanels; tabindex1based is the same as tabindex but is 1 based.

Returns: JSDataSet the dataset with form context

Sample

getFormWidth()

Gets the form width in pixels.

Returns: Number the width in pixels

Sample

getName()

Get the name of this form.

Returns: String the name

Sample

getPartHeight(partType)

Gets the part height in pixels.

Parameters

  • Number partType The type of the part whose height will be returned.

Returns: Number the part height in pixels

Sample

getPartYOffset(partType)

Returns the Y offset of a given part of the form.

Parameters

  • Number partType The type of the part whose Y offset will be returned.

Returns: Number A number holding the Y offset of the specified form part.

Sample

getSelectedIndex()

Gets the current record index of the current foundset.

Returns: Number the index

Sample

getTabSequence()

Get an array with the names of the components that are part of the tab sequence. The order of the names respects the order of the tab sequence. Components that are not named will not appear in the returned array, although they may be in the tab sequence.

Returns: Array array of names

Sample

getWindow()

Returns the JSWindow that the form is shown in, or null if the form is not currently showing in a window.

Returns: JSWindow the JSWindow that the form is shown in, or null if the form is not currently showing in a window.

Sample

loadAllRecords()

Loads all accessible records from the datasource into the form foundset. When the form contains a related foundset it will be replaced by a default foundset on same datasource. Or when this form is not configured to have a seperate foundset it will also be related with the default shared foundset.

So this is different then foundset.loadAllRecords() because that will just load all the records based on its filters of that foundset instance. This controller.loadAllRecords() can result in a replacement of the current loaded foundset instance.

Notes: -the default foundset is always limited by filters, if databaseManager.addFoundSetFilterParam function is used. -typical use is loading the normal foundset again after form usage in a related tabpanel

Returns: Boolean true if successful

Sample

loadRecords(foundset)

Loads a (related) foundset into the form. The form will no longer share the default foundset with forms of the same datasource, use controller.loadAllRecords() to restore the default foundset. (restore to default foundset depends a bit on if the give foundset is a related foundset or not or if this form is configured to have a seperated foundset)

This will really change the foundset instance itself of the form, so no existing foundset is altered just the new foundset that is given is used.. This is different then doing foundset.loadRecords(foundset) because that just alters the current foundset and doesn't do anything with the foundset that is given.

controller.loadRecords( relation ) will always replace with related fs [default]controller.loadRecords( fs ) will replace default fs with the given foundset, foundset filters set previously on the forms foundset are gone, only the foundset filters on the given foundset are set. [separate/named]controller.loadRecords( fs ) will behave like foundset.loadRecords(fs) if the form has already a separate/named foundset but foundset filters set previously on the forms foundset are gone, only the foundset filters on the given foundset are set.

foundset.loadRecords(fs) will adjust the current forms foundset and the foundset filters that are set are kept and merged with the filters of the given foundset.

Parameters

Returns: Boolean true if successful

Sample

loadRecords(foundset)

Loads a (related) foundset into the form. The form will no longer share the default foundset with forms of the same datasource, use loadAllRecords to restore the default foundset.

This will really update the foundset instance itself of the form, so now existing foundset is altered just the new foundset is shown. This is different then doing foundset.loadRecords(foundset) because that just alters the current foundset and doesn't do anything with the foundset that is given.

When the form uses a seperate foundset, foundset filter params are copied over from the source foundset and are merged with the existing filters.

Parameters

Returns: Boolean true if successful

Sample

recreateUI()

Recreates the forms UI components, to reflect the latest solution model. Use this after altering the elements via solutionModel at the JSForm of this form.

Returns: Boolean true if successful

Sample

Start the database search and use the results, returns the number of records, make sure you did "find" function first. Clear results from previous searches.

Note: Omitted records are automatically excluded when performing a search - meaning that the foundset result by default will not include omitted records.

Returns: Number the recordCount

Sample

search(clearLastResults)

Start the database search and use the results, returns the number of records, make sure you did "find" function first. Reduce results from previous searches.

Note: Omitted records are automatically excluded when performing a search - meaning that the foundset result by default will not include omitted records.

Parameters

  • Boolean clearLastResults boolean, clear previous search, default true

Returns: Number the recordCount

Sample

search(clearLastResults, reduceSearch)

Start the database search and use the results, returns the number of records, make sure you did "find" function first.

Note: Omitted records are automatically excluded when performing a search - meaning that the foundset result by default will not include omitted records.

Parameters

  • Boolean clearLastResults boolean, clear previous search, default true

  • Boolean reduceSearch boolean, reduce (true) or extend (false) previous search results, default true

Returns: Number the recordCount

Sample

setDataProviderValue(dataprovider, value)

Sets the value based on a specified dataprovider name.

Parameters

  • String dataprovider the dataprovider name to set the value for

  • Object value the value to set in the dataprovider

Returns: void

Sample

setDesignMode(designMode)

Sets this form in designmode with param true, false will return to normal browse/edit mode.

Parameters

  • Boolean designMode sets form in design mode if true, false ends design mode.

Returns: void

Sample

setDesignMode(ondrag)

Sets this form in designmode with one or more callback methods.

Parameters

Returns: void

Sample

setDesignMode(ondrag, ondrop)

Sets this form in designmode with one or more callback methods.

Parameters

Returns: void

Sample

setDesignMode(ondrag, ondrop, onselect)

Sets this form in designmode with one or more callback methods.

Parameters

  • Function ondrag onDrag method reference

  • Function ondrop onDrop method reference

  • Function onselect onSelect method reference

Returns: void

Sample

setDesignMode(ondrag, ondrop, onselect, onresize)

Sets this form in designmode with one or more callback methods.

Parameters

  • Function ondrag onDrag method reference

  • Function ondrop onDrop method reference

  • Function onselect onSelect method reference

  • Function onresize onResize method reference

Returns: void

Sample

setDesignMode(ondrag, ondrop, onselect, onresize, ondblclick)

Sets this form in designmode with one or more callback methods.

Parameters

  • Function ondrag onDrag method reference

  • Function ondrop onDrop method reference

  • Function onselect onSelect method reference

  • Function onresize onResize method reference

  • Function ondblclick onDblClick method reference

Returns: void

Sample

setDesignMode(ondrag, ondrop, onselect, onresize, ondblclick, onrightclick)

Sets this form in designmode with one or more callback methods.

Parameters

  • Function ondrag onDrag method reference

  • Function ondrop onDrop method reference

  • Function onselect onSelect method reference

  • Function onresize onResize method reference

  • Function ondblclick onDblClick method reference

  • Function onrightclick onRightClick method reference

Returns: void

Sample

setSelectedIndex(index)

Sets the current record index of the current foundset.

Parameters

  • Number index the index to select

Returns: void

Sample

setTabSequence(arrayOfElements)

Set the tab order sequence programatically, by passing the elements references in a javascript array.

Parameters

  • Array arrayOfElements array containing the element references

Returns: void

Sample

show()

Shows the form (makes the form visible) This function does not affect the form foundset in any way.

Returns: void

Sample

show(window)

Shows the form (makes the form visible) This function does not affect the form foundset in any way.

Parameters

  • JSWindow window the window in which this form should be shown, given as a window object

Returns: void

Sample

show(window)

Shows the form (makes the form visible) This function does not affect the form foundset in any way.

Parameters

  • String window the window in which this form should be shown, specified by the name of an existing window

Returns: void

Sample

showRecords(foundset)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • JSFoundSet foundset the foundset to load before showing the form.

Returns: void

Sample

showRecords(foundset, window)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • JSFoundSet foundset the foundset to load before showing the form.

  • JSWindow window the window in which this form should be shown, given as a window object.

Returns: void

Sample

showRecords(foundset, window)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • JSFoundSet foundset the foundset to load before showing the form.

  • String window the window in which this form should be shown, specified by the name of an existing window.

Returns: void

Sample

showRecords(pkdataset)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • JSDataSet pkdataset the pkdataset to load before showing the form.

Returns: void

Sample

showRecords(pkdataset, window)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • JSDataSet pkdataset the pkdataset to load before showing the form.

  • JSWindow window the window in which this form should be shown, given as a window object.

Returns: void

Sample

showRecords(pkdataset, window)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • JSDataSet pkdataset the pkdataset to load before showing the form.

  • String window the window in which this form should be shown, specified by the name of an existing window.

Returns: void

Sample

showRecords(query)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • QBSelect query the query to load before showing the form.

Returns: void

Sample

showRecords(query, window)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • QBSelect query the query to load before showing the form.

  • JSWindow window the window in which this form should be shown, given as a window object.

Returns: void

Sample

showRecords(query, window)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • QBSelect query the query to load before showing the form.

  • String window the window in which this form should be shown, specified by the name of an existing window.

Returns: void

Sample

showRecords(UUIDpk)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • UUID UUIDpk the UUIDpk to load before showing the form.

Returns: void

Sample

showRecords(UUIDpk, window)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • UUID UUIDpk the UUIDpk to load before showing the form.

  • JSWindow window the window in which this form should be shown, given as a window object.

Returns: void

Sample

showRecords(UUIDpk, window)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • UUID UUIDpk the UUIDpk to load before showing the form.

  • String window the window in which this form should be shown, specified by the name of an existing window.

Returns: void

Sample

showRecords(singleNumber_pk)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • Number singleNumber_pk the singleNumber_pk to load before showing the form.

Returns: void

Sample

showRecords(singleNumber_pk, window)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • Number singleNumber_pk the singleNumber_pk to load before showing the form.

  • JSWindow window the window in which this form should be shown, given as a window object

Returns: void

Sample

showRecords(singleNumber_pk, window)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • Number singleNumber_pk the singleNumber_pk to load before showing the form.

  • String window the window in which this form should be shown, specified by the name of an existing window.

Returns: void

Sample

showRecords(query)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • String query the query to load before showing the form.

Returns: void

Sample

showRecords(query, window)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • String query the query to load before showing the form.

  • JSWindow window the window in which this form should be shown, given as a window object

Returns: void

Sample

showRecords(query, argumentsArray)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • String query the query to load before showing the form.

  • Array argumentsArray the array of arguments for the query

Returns: void

Sample

showRecords(query, argumentsArray, window)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • String query the query to load before showing the form.

  • Array argumentsArray the array of arguments for the query

  • JSWindow window the window in which this form should be shown, given as a window object

Returns: void

Sample

showRecords(query, argumentsArray, window)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • String query the query to load before showing the form.

  • Array argumentsArray the array of arguments for the query

  • String window the window in which this form should be shown, specified by the name of an existing window.

Returns: void

Sample

showRecords(query, window)

Load data into the form and shows the form, is a shortcut for the functions 'loadRecords' and 'show'.

Parameters

  • String query the query to load before showing the form.

  • String window the window in which this form should be shown, specified by the name of an existing window.

Returns: void

Sample


Last updated

Was this helpful?