Module: alfresco/forms/controls/MultiSelectInput

alfresco/forms/controls/MultiSelectInput

An input control that allows multiple-selection of defined items. As this form controls makes use of a ServiceStore for options handling it is important that extra "labelAttribute", "queryAttribute", "valueAttribute" are set.

PLEASE NOTE: When specifying the labelAttribute, queryAttribute and valueAttribute in the optionsConfig as per the below example, the queryAttribute is used to search on and the labelAttribute is used to display, so they would normally be the same value.

Author:
  • Martin Doyle
License:
Source:

Example

Sample configuration:

{
   id: "MULTI_SELECT_1",
   name: "alfresco/forms/controls/MultiSelectInput",
   config: {
      label: "My multi-select input",
      name: "form_field_name",
      width: "400px",
      choiceCanWrap: false, // Whether chosen items' text can wrap over multiple lines (defaults to true)
      choiceMaxWidth: "50%", // The maximum width of chosen items (defaults to 100%)
      optionsConfig: {
         labelAttribute: "name",  // What's displayed in the dropdown and choice (defaults to label)
         queryAttribute: "name",  // The attribute that's used when filtering the dropdown (defaults to name)
         valueAttribute: "value", // The actual submitted value for each chosen item (defaults to value)
         publishTopic: "ALF_RETRIEVE_MULTISELECT_INFO",
         publishPayload: {
            resultsProperty: "response.data.items"
         },
         labelFormat: { // Optional label format strings (all default to item[this.store.labelAttribute] if not specified)
            choice: "{value}",
            result: "{label}",
            full: "{value} - {label}"
         },
         searchStartsWith: true // Whether the query attribute should start with the search string (defaults to false)
      }
   }
}

Members

getPubSubOptionsImmediately :boolean

Override the inherited value to suppress the initial retrieval of pubSubOptions for this control.
Type:
  • boolean
Since:
  • 1.0.33
Default Value:
  • false
Source:

valueDelimiter :string

An optional token that can be provided for splitting the supplied value. This should be configured when the value is provided as a string that needs to be converted into an array.
Type:
  • string
Since:
  • 1.0.77
Default Value:
  • null
Source:

Methods

createFormControl(config) → {object}

Creates a new ServiceStore object to use for retrieving and filtering the available options to be included in the control and then instantiates and returns the MultiSelect widget that is configured to use it.
Parameters:
Name Type Description
config object Configuration for the control
Source:
Returns:
The new control
Type
object

getWidgetConfig()

Source: