Lists of values
Example module: hellotypes, lovscopes property.
A list of values (LOV) offers suggestions or imposes a closed choice on a string/int/float element. It exists at three different scopes.
Element scope (local)
"lovelement": {
"type": "string",
"listOfValues": [
["e1", "Valeur 1"],
["e2", "Valeur 2"]
]
}A literal array of [key, label] pairs, specific to this element, never shared.
Module scope
{
"globallov": {
"malov": {
"type": "string",
"label": "Ma liste",
"values": [["mod1", "Valeur 1"], ["mod2", "Valeur 2"]]
}
},
"p": {
"mapropriete": {
"e": {
"monelement": { "type": "string", "listOfValues": "malov" }
}
}
}
}A named list, declared in the globallov section of the same JSON file, shared by all the module’s elements that reference it by name — invisible to other modules.
Controller scope
"monelement": {
"type": "string",
"listOfValues": "availableconfs",
"listOfValuesIsExternal": true
}A list maintained by the controller itself, shared by all modules on the server. Some existing controller lists: availableconfs (available configurations), indiconfigurations, optics, servers, equipments, locations, and two families generated dynamically for each loaded module — loadedModules-<type> and loadedFamilies-<family> (see Master/slave relationship).
listOfValuesIsExternal: true is what switches the scope from “module” to “controller” — without it, listOfValues would look for a list of the same name in the module’s globallov, not in the controller.
constrained: closed list or plain suggestion
By default, a list of values is only a suggestion (free-text field with autocompletion). setLovConstrained(true) turns it into a closed choice (dropdown menu, values from the list only):
getEltString("lovscopes", "monelement")->setLovConstrained(true);constrained is only set in code, in the module’s constructor — there is no JSON key equivalent to directedit/autoupdate for this setting.
constrained is a per-element setting, independent of the scope of the list it affects — an element can constrain a list from any of the three scopes above.
The arrays of pairs [["clé", "Libellé"], ...] above are the source JSON file format of a module — the one the developer writes. Once dumped to the client, listOfValues becomes an object {"clé": "Libellé"}, and the module/controller distinction appears under different names, globallov/lovScope, rather than listOfValues/listOfValuesIsExternal. Both formats describe the same thing at two different points in the chain — see the client protocol documentation for the wire format in detail.