JSValueList
Overview
JSValueList
is a wrapper for defining and managing value lists in the Solution Model. It supports multiple types, including custom values, database values, and global methods. It provides flexibility in configuring the display and return values, sorting, and filtering options, allowing dynamic value lists tailored to specific application needs. ## Functionality
JSValueList offers constants like CUSTOM_VALUES
and DATABASE_VALUES
to define its type. Properties such as dataSource
, relationName
, and sortOptions
allow integration with database tables and relations. Additional properties like addEmptyValue
and lazyLoading
enable control over list behavior, such as including an empty option or deferring list loading to improve performance. For global method-based value lists, a specified method can populate the list dynamically based on provided criteria.
Methods like setDisplayDataProviderIds
and setReturnDataProviderIds
configure the display and return data providers, while utility functions like getUUID
provide metadata access. Examples demonstrate usage scenarios, such as creating value lists from custom strings or database queries, and dynamically updating their configuration.
For more details, please refer to the Value list section of these documentation.
Constants Summarized
Properties Summarized
Property that tells if an empty value must be shown next to the items in the value list.
Compact representation of the names of the server and table that are used for loading the data from the database.
The global method of the valuelist is called to fill in or adjust the values of the valuelist.
A property, specific for NG & Titanium clients with GlobalValuelist - it helps to query/call the global valuelist method only when it is needed.
A String representing the separator that should be used when multiple display dataproviders are set, when the value list has the type set to database values.
The name of the database server that is used for loading the values when the value list has the type set to database/table values.
The name of the database table that is used for loading the values when the value list has the type set to database/table values.
Flag that tells if the name of the valuelist should be applied as a filter on the 'valuelist_name' column when retrieving the data from the database.
Methods Summarized
Returns an array of the dataproviders that will be used to display the valuelist value.
Returns an array of the dataproviders that will be used to define the valuelist value that is saved.
void
Set the display dataproviders.
void
Set the return dataproviders.
Constants Detailed
CUSTOM_VALUES
Constant to set the valueListType of a JSValueList. Sets the value list to use a custom list of values. Also used in solutionModel.newValueList(...) to create new valuelists
Type Number
Sample
DATABASE_VALUES
Constant to set the valueListType of a JSValueList. Sets the value list to use values loaded from a database. Also used in solutionModel.newValueList(...) to create new valuelists
Type Number
Sample
EMPTY_VALUE_ALWAYS
Constant to set/get the addEmptyValue property of a JSValueList.
Type Number
Sample
EMPTY_VALUE_NEVER
Constant to set/get the addEmptyValue property of a JSValueList.
Type Number
Sample
Properties Detailed
addEmptyValue
Property that tells if an empty value must be shown next to the items in the value list.
Type Number The configuration for adding an empty value to the value list.
Sample
customValues
A string with the elements in the valuelist. The elements can be separated by line feeds: custom1 custom2
Elements can optionally have real values: custom1|1 custom2|2
The (custom) values can be given via a global scope method instead, if the valuelist type is of global method type...
Type String The custom values defined for the value list, separated by newlines or pipes.
Sample
dataSource
Compact representation of the names of the server and table that are used for loading the data from the database.
Type String The data source associated with the value list.
Sample
displayValueType
Gets the display value
Type Number The data type of the display value in the value list.
Sample
fallbackValueList
Gets or sets the fallback valuelist.
Type JSValueList The fallback value list associated with this value list, or null if none is set.
Sample
globalMethod
The global method of the valuelist is called to fill in or adjust the values of the valuelist. The method returns a dataset with one or two columns, first column is the display value, second column is real value(if present). The valuelist will be filled in with the dataset data. If second column is not present real value and display value will be the same. The method has to handle three different scenarios: 1. 'displayValue' parameter is not null, this parameter should be used to filter the list of values(in a typeahead fashion) 2. 'realValue' parameter is specified, that means value was not found in current list, so must be specified manually. In this case method should return only one row in the dataset, with the missing value, that will be added to the valuelist 3. 'realValue' and 'displayValue' are both null , in this case the complete list of values should be returned.
Scenario 1 and 3 will completely replace any older results in the valuelist while scenario 2 will append results.
In find mode the record will be the FindRecord which is just like a normal JSRecord (DataRecord) it has the same properties (column/dataproviders) but doesnt have its methods (like isEditing())
The last argument is rawDisplayValue which contains the same text as displayValue but without converting it to lowercase.
Type JSMethod The global method used to populate or adjust the value list.
Sample