▾
import LayerListModel from "@arcgis/core/layerList/LayerListModel.js";const LayerListModel = await $arcgis.import("@arcgis/core/layerList/LayerListModel.js");- Inheritance
- LayerListModel→
Accessor
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Manages the Item instances displayed for operational layers in a layer-list workflow.
The collection tracks the view's layers and layer views, creates and updates list items, and supports
custom item configuration, actions, visibility filtering, and reordering.
To exclude a layer from the collection, set its Layer.listMode property to hide.
Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | The properties used to configure the collection. | |
Properties
| Property | Type | Class |
|---|---|---|
| | ||
| readonly inherited | ||
| | ||
| | ||
| readonly | | |
| readonly | | |
| readonly | | |
| |
checkPublishStatusEnabled
- Type
- boolean
Indicates whether items should report when their associated layers are being published.
When false, the Item.publishing property is always false.
- Default value
- false
listItemCreatedFunction
- Type
- ItemModifier | null | undefined
A function called when each Item is created. Use the callback to modify supported item properties or add actions through the Item.actionsSections property.
listModeDisabled
- Type
- boolean
Indicates whether to ignore the Layer.listMode property when determining which layers to display.
When true, layers with a listMode of hide are included.
- See also
- Default value
- false
operationalItems
- Type
- Collection<Item>
The items representing operational layers in the view.
Items are ordered to match the map's layer order and can include nested child items.
To exclude a layer, set its Layer.listMode property to hide.
- See also
state
- Type
- State
The current state of the collection.
Returns disabled when no view is set, loading while the view is not ready, and ready when
the view is ready to provide operational layer items.
- Default value
- "disabled"
view
- Type
- MapViewOrSceneView | null | undefined
The map or scene view that supplies the operational layers and layer views for this collection.
Methods
| Method | Signature | Class |
|---|---|---|
| inherited | emit<Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean | |
| inherited | hasEventListener<Type extends EventNames<this>>(type: Type): boolean | |
| moveItem(targetItem: Item | null | undefined, fromParentItem: Item | null | undefined, toParentItem: Item | null | undefined, newIndex: number): void | | |
| inherited | on<Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle | |
| triggerAction(action: Action, item: Item): void | |
emit
- Signature
-
emit <Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean
- Type parameters
- <Type extends EventNames<this>>
- Since
- ArcGIS Maps SDK for JavaScript 4.5
Emits an event on the instance. This method should only be used when creating subclasses of this class.
hasEventListener
- Signature
-
hasEventListener <Type extends EventNames<this>>(type: Type): boolean
- Type parameters
- <Type extends EventNames<this>>
Indicates whether there is an event listener on the instance that matches the provided event name.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| type | Type | The name of the event. | |
- Returns
- boolean
Returns true if the class supports the input event.
moveItem
- Signature
-
moveItem (targetItem: Item | null | undefined, fromParentItem: Item | null | undefined, toParentItem: Item | null | undefined, newIndex: number): void
Moves a layer item within the map or between supported parent layers.
The item must represent a layer, and sublayers cannot be moved with this method.
The target index uses the layer collection's order, where 0 represents the top position in the list.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| targetItem | The item to move. | | |
| fromParentItem | The item's current parent, if it has one. | | |
| toParentItem | The target parent, if the item is being moved into a child collection. | | |
| newIndex | The target position in the destination collection. | |
- Returns
- void
on
- Signature
-
on <Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle
- Type parameters
- <Type extends EventNames<this>>
Registers an event handler on the instance. Call this method to hook an event with a listener.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| type | Type | An event or an array of events to listen for. | |
| listener | EventedCallback<this["@eventTypes"][Type]> | The function to call when the event fires. | |
- Returns
- ResourceHandle
Returns an event handler with a
remove()method that should be called to stop listening for the event(s).Property Type Description remove Function When called, removes the listener from the event.
- Example
- view.on("click", function(event){// event is the event handle returned after the event fires.console.log(event.mapPoint);});
triggerAction
- Signature
-
triggerAction (action: Action, item: Item): void
Executes an enabled action associated with an item and emits the @trigger-action event. Disabled actions are ignored.
Events
trigger-action
trigger-action: CustomEvent<LayerListModelTriggerActionEvent> Emitted when the user clicks an action or action toggle in a layer list. Use this event to run custom logic when a specific action is triggered. The event object is a LayerListModelTriggerActionEvent.
- See also