MenuFoundSet
Last updated
Last updated
MenuFoundSet
enables a menu structure to function as a datasource, allowing menu items to be treated as records within the Servoy Developer environment. This provides access to menu properties as dataproviders, which are read-only, and supports hierarchical relationships, such as parent-child structures based on parentid
. These capabilities allow components like DBTreeView to work seamlessly with menu records and enable complex menu representations with FormComponents.
For further details on setting up and working with datasources, see Datasource Setup.
Type | Name | Summary |
---|---|---|
Type | Name | Summary |
---|---|---|
Returns true if this foundset is in multiselect mode and false if it's in single-select mode.
Type Boolean true if this foundset is in multiselect mode and false if it's in single-select mode.
Iterates over the records of a foundset taking into account inserts and deletes that may happen at the same time. It will dynamically load all records in the foundset (using Servoy lazy loading mechanism). If callback function returns a non null value the traversal will be stopped and that value is returned. If no value is returned all records of the foundset will be traversed. Foundset modifications( like sort, omit...) cannot be performed in the callback function. If foundset is modified an exception will be thrown. This exception will also happen if a refresh happens because of a rollback call for records on this datasource when iterating. When an exception is thrown from the callback function, the iteration over the foundset will be stopped.
Parameters
Function callback The callback function to be called for each loaded record in the foundset. Can receive three parameters: the record to be processed, the index of the record in the foundset, and the foundset that is traversed.
Returns: Object Object the return value of the callback
Sample
Iterates over the records of a foundset taking into account inserts and deletes that may happen at the same time. It will dynamically load all records in the foundset (using Servoy lazy loading mechanism). If callback function returns a non null value the traversal will be stopped and that value is returned. If no value is returned all records of the foundset will be traversed. Foundset modifications( like sort, omit...) cannot be performed in the callback function. If foundset is modified an exception will be thrown. This exception will also happen if a refresh happens because of a rollback call for records on this datasource when iterating. When an exception is thrown from the callback function, the iteration over the foundset will be stopped.
Parameters
Function callback The callback function to be called for each loaded record in the foundset. Can receive three parameters: the record to be processed, the index of the record in the foundset, and the foundset that is traversed.
Object thisObject What the this object should be in the callback function (default it is the foundset)
Returns: Object Object the return value of the callback
Sample
Returns the datasource (menu:name) for this MenuFoundSet.
Returns: String
Sample
Get foundset name (menu name).
Returns: String name.
Sample
Get the MenuItemRecord object at the given index. Argument "index" is 1 based (so first record is 1).
Parameters
Number index record index (1 based).
Returns: JSRecord MenuItemRecord record.
Sample
Get the record index. Will return -1 if the record can't be found.
Parameters
JSRecord record MenuItemRecord
Returns: Number int index.
Sample
Get the current record index of the foundset.
Returns: Number int current index (1-based)
Sample
Get the indexes of the selected records. When the foundset is in multiSelect mode (see property multiSelect), a selection can consist of more than one index.
Returns: Array Array current indexes (1-based)
Sample
Returns: JSRecord
Get the selected records. When the menu foundset is in multiSelect mode (see property multiSelect), selection can be a more than 1 record.
Returns: Array Array current records.
Sample
Get the number of records in this menu foundset. All records are loaded when foundset is initialized.
Returns: Number int current size.
Sample
Set the current record index.
Parameters
Number index index to set (1-based)
Returns: void
Sample
Set the selected records indexes.
Parameters
Array indexes An array with indexes to set.
Returns: void
Sample
Returns true if this foundset is in multiselect mode and false if it's in single-select mode.
Iterates over the records of a foundset taking into account inserts and deletes that may happen at the same time.
Iterates over the records of a foundset taking into account inserts and deletes that may happen at the same time.
Returns the datasource (menu:name) for this MenuFoundSet.
Get foundset name (menu name).
Get the MenuItemRecord object at the given index.
Get the record index.
Get the current record index of the foundset.
Get the indexes of the selected records.
Get the selected records.
Get the number of records in this menu foundset.
void
Set the current record index.
void
Set the selected records indexes.