Skip to content
import TableListViewModel from "@arcgis/core/widgets/TableList/TableListViewModel.js";
Inheritance:
TableListViewModelAccessor
Since
ArcGIS Maps SDK for JavaScript 4.17

Provides the logic for the TableList widget and component.

See also
Example
const tableList = new TableList({
viewModel: { // autocasts as new TableListViewModel
map: map // specify the map containing the tables
}
});

Constructors

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.

checkPublishStatusEnabled

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 4.25

Whether to provide an indication if a layer is being published in the TableList. When a layer is publishing, a rotating square will appear to the right of the list item title. The ListItem.publishing property will be false if checkPublishStatusEnabled is false.

Default value
false

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor

The name of the class. The declared class name is formatted as esri.folder.className.

listItemCreatedFunction

Property
Type
ListItemModifier | null | undefined

Specifies a function that accesses each ListItem. Each list item can be modified according to its modifiable properties. Actions can be added to list items using the ListItem.actionsSections property.

listModeDisabled

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 4.30

Specifies whether to ignore the Layer.listMode property of the layers to display all tables. A common use case for listModeDisabled is when you want to use the TableList to manage and configure a tables's listMode value.

See also
Default value
false

map

Property
Type
WebMap | WebScene | null | undefined

A reference to the Map containing the tables. Set this property to access the underlying tables within the map.

See also
Example
// FeatureLayer.isTable = true.
Layer.fromPortalItem({
// Loads a layer (table) from a portal item
portalItem: { // autocasts new PortalItem()
id: "add portal id item"
}
}).then(function(layer) {
// Load the layer
layer.load().then(function() {
// Check if the layer is a table
if (layer.isTable) {
map.tables.add(layer);
console.log(map.tables);
}
});
});
const tableList = new TableList({
map: map // map contains tables collection
});

state

readonly Property
Type
State

The view model's state.

Default value
"disabled"

tableItems

readonly Property
Type
Collection<ListItem>

The collection of table ListItems displayed within the widget.

tables

Property
Type
ReadonlyCollection<Layer | Sublayer> | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.32

A collection of Layer instances that are tables.

Example
const tableList = new TableListViewModel({
tables: tables
});

totalItems

readonly Property
Type
number
Since
ArcGIS Maps SDK for JavaScript 4.32

The total number of tableItems in the list.

See also

Methods

MethodSignatureClass
emit
inherited
emit<Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean
hasEventListener
inherited
hasEventListener<Type extends EventNames<this>>(type: Type): boolean
on
inherited
on<Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle
triggerAction(action: Action, item: ListItem): void

emit

inherited Method
Signature
emit <Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean
Type parameters
<Type extends EventNames<this>>
Inherited from: EventedMixin

Emits an event on the instance. This method should only be used when creating subclasses of this class.

Parameters
ParameterTypeDescriptionRequired
type
Type

The name of the event.

event
this["@eventTypes"][Type]

The event payload.

Returns
boolean

true if a listener was notified

hasEventListener

inherited Method
Signature
hasEventListener <Type extends EventNames<this>>(type: Type): boolean
Type parameters
<Type extends EventNames<this>>
Inherited from: EventedMixin

Indicates whether there is an event listener on the instance that matches the provided event name.

Parameters
ParameterTypeDescriptionRequired
type
Type

The name of the event.

Returns
boolean

Returns true if the class supports the input event.

on

inherited Method
Signature
on <Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle
Type parameters
<Type extends EventNames<this>>
Inherited from: EventedMixin

Registers an event handler on the instance. Call this method to hook an event with a listener.

Parameters
ParameterTypeDescriptionRequired
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).

PropertyTypeDescription
removeFunctionWhen 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

Method
Signature
triggerAction (action: Action, item: ListItem): void

Triggers the @trigger-action event and executes the given action or action toggle.

Parameters
ParameterTypeDescriptionRequired
action

The action to execute.

item

An item associated with the action.

Returns
void

Events

trigger-action

Event

Emitted when the user clicks an action or action toggle in a table list. Use this event to run custom logic when a specific action is triggered.

See also
bubbles composed cancelable

Type definitions

TableListViewModelTriggerActionEvent

Type definition

The event object for the trigger-action event in the table list.

See also

action

Property
Type
Action

The action clicked by the user.

item

Property
Type
ListItem

An item associated with the action.