Provides the logic for the LayerList widget.
Constructors
new LayerListViewModel(properties)
properties Object See the properties for a list of all the properties that may be passed into the constructor. |
Property Overview
Name | Type | Summary | |
---|---|---|---|
Function | Use listItemCreatedFunction instead. Specify the function that will create actions for ListItems.* more details | more details | |
String | The name of the class. more details | more details | |
Function | Specifies a function that accesses each ListItem. more details | more details | |
Collection | A collection of ListItems representing operational layers. more details | more details | |
String | The view model's state. more details | more details | |
MapView | SceneView | The view from which the widget will operate. more details | more details |
Property Details
- Deprecated
createActionsFunctionFunction
- Since version 4.4.
Use listItemCreatedFunction instead.
Specify the function that will create actions for ListItems. Actions are defined with the properties listed in the Action class.
declaredClassStringreadonly
The name of the class. The declared class name is formatted as
esri.folder.className
.listItemCreatedFunctionFunction
Since: ArcGIS API for JavaScript 4.4Specifies a function that accesses each ListItem. Each list item can be modified according to its modifiable propeties. Actions can be added to list items using the actionsSections property of the ListItem.
Example:layerListViewModel.listItemCreatedFunction = function (event) { // The event object contains properties of the // layer in the LayerList widget. var item = event.item; if (item.title === "US Demographics") { // open the list item in the LayerList item.open = true; // change the title to something more descriptive item.title = "Population by county"; // set an action for zooming to the full extent of the layer item.actionsSections = [[{ title: "Go to full extent", className: "esri-icon-zoom-out-fixed", id: "full-extent" }]]; } });
operationalItemsCollectionreadonly
A collection of ListItems representing operational layers.
stateStringreadonly
The view model's state.
Known Values: ready | disabled
Default Value: disabledThe view from which the widget will operate.
Method Overview
Name | Return Type | Summary | |
---|---|---|---|
Triggers the trigger-action event and executes the given action. more details | more details |
Method Details
triggerAction(action, item)
Triggers the trigger-action event and executes the given action.
Parameters:action ActionThe action to execute.
item ListItemAn item associated with the action.
Event Overview
Name | Type | Summary | |
---|---|---|---|
{action: Action,item: ListItem} | Fires after the user clicks on an action inside the LayerList widget. more details | more details |