This service provides a way of requesting options data for form controls, providing
normalization of the data so that it adheres to the structure expected by form controls
- Copyright:
- Copyright (C) 2005-2020 Alfresco Software Limited
- License:
- GNU Lesser General Public License, see: Open Source Licensing
- Source:
Example
publishTopic: "ALF_GET_FORM_CONTROL_OPTIONS",
publishPayload: {
url: url.context + "/proxy/alfresco/api/people",
itemsAttribute: "people",
labelAttribute: "userName",
valueAttribute: "userName"
}
Mixes In
Methods
-
onOptionsRequest(payload)
-
Handles request to retrieve and normalize options data, the following attributes must be provided on the payload:
- url (e.g. AlfConstants.PROXY_URI + "api/groups")
- itemsAttribute - dot-notation address of items array (e.g. "data")(
- labelAttribute - dot-notation for label within each item (e.g. "displayName")
- valueAttribute - dot-notation for value within each item (e.g. "fullName")
- responseTopic - this is automatically provided by Aikau form controls
Parameters:
Name Type Description payload
object - Source:
-
optionsFailure(response, originalRequestConfig)
-
Parameters:
Name Type Description response
object originalRequestConfig
object - Source:
-
optionsProgress(response, originalRequestConfig)
-
Handles progress updates by doing nothing. See AKU-884.
Parameters:
Name Type Description response
object originalRequestConfig
object - Since:
- 1.0.60
- Source:
-
optionsSuccess(response, originalRequestConfig)
-
This function is called whenever the raw options data is successfully retrieved. It locates the attribute within the reponse that contains the options (via the "itemsAttribute") and then calls the processOptions function to convert the raw data into the expected structure (e.g. an array of objects containing "label" and "value" attributes).
Parameters:
Name Type Description response
object originalRequestConfig
object - Source:
-
processOptions(options, config, item, index)
-
Uses the dot-notation addresses for the label and value to add a new option to the supplied option array.
Parameters:
Name Type Description options
array The array to add the processed item to config
object The configuration to use for processing the option item
object The current item to process as an option index
number The index of the item in the items list - Source:
-
registerSubscriptions()
-
Sets up the subscriptions for the OptionsService
- Since:
- 1.0.32
- Source:
Listens to Events: