ListItem
esri/widgets/LayerList/ListItem
The ListItem class represents one of the operationalItems in the LayerListViewModel. In the LayerList widget UI, the list item represents a layer displayed in the view. It provides access to the associated layer's properties, allows the developer to configure actions related to the layer, and allows the developer to add content to the item related to the layer.
To hide list items in the LayerList widget, you must set the listMode property on the desired layers to hide
. You cannot hide list items using this class or the LayerList class.
- See also:
Property Overview
Name | Type | Summary | Class | |
---|---|---|---|---|
Boolean | Whether the actional panel is open in the LayerList. more details | more details | ListItem | |
Collection<Collection<(ActionButton|ActionToggle)>> | A nested 2-dimensional collection of actions that could be triggered on the item. more details | more details | ListItem | |
Collection<ListItem> | When a layer contains sublayers, this property is a Collection of ListItem objects belonging to the given layer. more details | more details | ListItem | |
Error | The Error object returned if an error occurred. more details | more details | ListItem | |
Layer | The layer associated with the triggered action. more details | more details | ListItem | |
LayerView | The LayerView displaying data for the associated layer. more details | more details | ListItem | |
Boolean | Whether the layer is open in the LayerList. more details | more details | ListItem | |
ListItemPanel | Allows you to display custom content for each ListItem in the LayerList widget. more details | more details | ListItem | |
ListItem | The parent of this item more details | more details | ListItem | |
String | The title of the layer. more details | more details | ListItem | |
Boolean | Value is | more details | ListItem | |
MapView|SceneView | The view from which the widget will operate. more details | more details | ListItem | |
String | Indicates how to manage the visibility of the children layers. more details | more details | ListItem | |
Boolean | Indicates if the ListItem is visible. more details | more details | ListItem | |
Boolean | Whether the layer is visible at the current scale or not. more details | more details | ListItem |
Property Details
- actionsOpen Boolean
Whether the actional panel is open in the LayerList.
- Default Value:false
- actionsSections Collection<Collection<(ActionButton|ActionToggle)>>autocast
A nested 2-dimensional collection of actions that could be triggered on the item.
- children Collection<ListItem>
When a layer contains sublayers, this property is a Collection of ListItem objects belonging to the given layer.
- error Errorreadonly
The Error object returned if an error occurred.
- layer Layer
The layer associated with the triggered action.
- Default Value:null
- layerView LayerViewreadonly
- open Boolean
Whether the layer is open in the LayerList.
- Default Value:false
- panel ListItemPanelSince: ArcGIS API for JavaScript 4.7
Allows you to display custom content for each ListItem in the LayerList widget.
A common scenario for using ListItemPanel is to display a Legend widget within each list item. The
legend
keyword can be used in the content property of the panel to display a legend for each layer in the LayerList.Examples:// displays the legend for each layer list item const layerList = new LayerList({ view: view, listItemCreatedFunction: function(event){ const item = event.item; item.panel = { content: "legend" }; } });
// displays content from the DOM in the LayerList const layerList = new LayerList({ view: view, listItemCreatedFunction: function(event){ const item = event.item; item.panel = { content: document.getElementById("myDiv"), className: "esri-icon-chart", open: item.visible }; } });
- parent ListItemSince: ArcGIS API for JavaScript 4.5
The parent of this item
- Default Value:null
- title String
The title of the layer.
- updating Booleanreadonly
Value is
true
when the layer is updating; for example, if it is in the process of fetching data.- Default Value:false
The view from which the widget will operate.
- visibilityMode Stringreadonly
Indicates how to manage the visibility of the children layers.
- visible Boolean
Indicates if the ListItem is visible.
- Default Value:true
- visibleAtCurrentScale Booleanreadonly
Whether the layer is visible at the current scale or not.
- Default Value:true
Method Overview
Name | Return Type | Summary | Class | |
---|---|---|---|---|
ListItem | Creates a deep clone of this object. more details | more details | ListItem |