A list from which a user may select one or several items.
The ``aps/MultiSelect`` widget allows you to display a list from which a user may select one or several items. To make selection, the user can use special buttons or Drag and Drop.
Table of contents
All user panels - CP and UX1
The aps/MultiSelect
widget builds and presents a list of entries from a data source reference from the store
property.
A store
is an object based on the aps/Store
or aps/Memory
module. Every entry consists of two properties:
data
Data that will be visually displayed in the list item.
value
Item value that will be saved if the user selects this item.
The items selected by the user are stored in the values
object of the dojox/mvc/StatefulArray
type that contains
values of the items selected by the user. It is available for
dynamic programmatic change.
If you need to create an aps/MultiSelect
container with already selected items,
you should pass to the constructor a StatefulArray
object with
already defined item values. If the property is not defined when
the widget is being created, a new empty object will be created.
If you programmatically place into the object a value that does not
match the value
property of any item, a new item will be
created.
require(["aps/load", "aps/Memory", "dojox/mvc/StatefulArray", "aps/ready!"],
function(load, Memory, StatefulArray){
"use strict";
var data = [{ label: "SiteBuilder", value: 1 },
{ label: "2 Additional Gigabytes", value: 2 },
{ label: "5 Additional Gigabytes", value: 3 }];
var store = new Memory({
idProperty: "value",
data: data
});
var valuesArray = new StatefulArray([1]);
load(["aps/PageContainer", [
["aps/Panel", { title: "Load example" }, [
["aps/MultiSelect", {
titleLeft: "Available:",
store: store,
titleRight: "Selected:",
values: valuesArray,
labelAttr: "label"
}]
]]]]);
});
PROPERTY | TYPE | DEFAULT | DESCRIPTION |
---|---|---|---|
disabled |
boolean | Should this widget respond to user input Default value: false. | |
gridSize | string | undefined | This specifies the widget width that is relevant only for widgets inside Container, FieldSet, or Tiles. |
isBusy | boolean | false | If the widget is busy then this property is true. |
label | string | “” | Text that is shown as a label if the widget is placed inside a aps/FieldSet. |
labelAttr | string | label | The entries in the drop down list come from this attribute in the dojo. |
source | object | Data available for selection. | |
titleLeft | string | Left list title. | |
titleRight | string | Right list title. | |
values | array | Data selected by the user. | |
visible | boolean | true | If this property value is set to true, then the widget is visible. |
This specifies the widget width that is relevant only for widgets inside Container, FieldSet, or Tiles. In other cases it will be ignored.
gridSize string contains few options with number values (from 1 to 12) separated by spaces, which specify the grid size of the widget in different layouts:
- md - desktop
- xs - phone
For example, gridSize: “md-4 xs-2”.
All values below 1, e.g. “md-0”, will be replaced with the empty string (“”), values above 12, e.g. “md-14”, will be reduced to 12 (“md-12”).
Default value: undefined.
Text that is shown as a label if the widget is placed inside a aps/FieldSet.
Default value: “”.
The entries in the drop down list come from this attribute in the dojo.store items. If store is set, labelAttr must be set too, unless store is an old-style dojo.data store rather than a new dojo/store. Default value: “label”
Data available for selection. Default value: null
Left list title. Default value: “”
Right list title. Default value: “”
Data selected by the user. Default value: null
If this property value is set to true, then the widget is visible.
Default value: true.
METHOD | RETURN | DESCRIPTION |
---|---|---|
cancel () | object
|
Sets the isBusy property to false |
destroy () | undefined
|
Destroys this widget |
get () | any
|
Get a property of the Stateful instance |
getParents () | array
|
Discover and return all parents of the widget |
placeAt () | dijit/_widgetbase
function
|
Place this widget somewhere in the DOM based on standard dojo/dom-construct::place() conventions |
set () | object
function
|
Set a property of the Stateful instance |
startup () | undefined
|
Gets started after the DOM fragment is added to the document |
Destroys this widget. Will also destroy any resources (including widgets) registered via this.own(). This method will also destroy internal widgets such as those created from a template.
Return: undefined
Get a property of the Stateful instance. Get a named property of the Stateful object. The property may potentially be retrieved via a getter method in subclasses.
In the base class, this just retrieves the object’s property.
Return: any
Place this widget somewhere in the DOM based on standard dojo/dom-construct::place() conventions. A convenience function providing a simple shorthand mechanism to put an existing (or newly created) widget somewhere in the DOM, and allow chaining.
Return: dijit/_widgetbase function
Set a property of the Stateful instance. Sets named properties of the stateful object and notifies the watchers of the property. A programmatic setter may be defined in subclasses.
Return: object function
Gets started after the DOM fragment is added to the document Called after the widget and its children have been created and added to the page, and all related widgets have finished their create() cycle, up through postCreate().
Note that startup() may be called while the widget is still hidden, for example if the widget is inside a hidden dijit/Dialog or an unselected tab of a dijit/layout/TabContainer. For widgets that need to do layout, it’s best to put that layout code inside resize(), and then extend dijit/layout/_LayoutWidget so that resize() is called when the widget is visible.
Return: undefined
EVENT | RETURN | DESCRIPTION |
---|---|---|
onClick () | undefined
|
The method is called when a user clicks on the widget |
The method is called when a user clicks on the widget.