TableListViewModel

AMD: require(["esri/widgets/TableList/TableListViewModel"], (TableListVM) => { /* code goes here */ });
ESM: import TableListVM from "@arcgis/core/widgets/TableList/TableListViewModel";
Object: esri/widgets/TableList/TableListViewModel
Since: ArcGIS API for JavaScript 4.17
See also
Example
const tableList = new TableList({
  viewModel: { // autocasts as new TableListViewModel
    map: map // specify the map containing the tables
  }
});

Property Overview

Name Type Summary Object
Boolean

Whether to provide an indication if a layer is being published in the TableList.

more details
TableListViewModel
ListItemCreatedHandler

Specifies a function that accesses each ListItem.

more details
TableListViewModel
Map|WebMap

A reference to the map containing the tables.

more details
TableListViewModel
String

The view model's state.

more details
TableListViewModel
Collection<ListItem>

The collection of table ListItems displayed within the widget.

more details
TableListViewModel

Property Details

checkPublishStatusEnabled Boolean
Since: ArcGIS API 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 list item publishing property will be false if checkPublishStatusEnabled is false.

Default Value:false
listItemCreatedFunction ListItemCreatedHandler

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 actionsSections property of the ListItem.

map Map|WebMap

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 Stringreadonly

The view model's state.

Possible Values:"loading"|"ready"|"disabled"

Default Value:disabled
tableItems Collection<ListItem>readonly

The collection of table ListItems displayed within the widget.

Type Definitions

ListItemCreatedHandler(event)

Function definition for the listItemCreatedFunction property.

Parameters
event Object

An object containing a list item created by the TableList.

Specification
item ListItem

A list item created by the TableListViewModel. You can modify the properties of this item to customize the text, actions, and visibility of the list item. See the documentation for the listItemCreatedFunction for more details.

Event Overview

Name Type Summary Object
{action: ActionButton,ActionToggle,item: ListItem}

Fires after the user clicks on an action or action toggle inside the TableList widget.

more details
TableListViewModel

Event Details

trigger-action

Fires after the user clicks on an action or action toggle inside the TableList widget. This event may be used to define a custom function to execute when particular actions are clicked.

Properties

The action clicked by the user.

item ListItem

An item associated with the action.

Example
tableList.viewModel.on("trigger-action", function (event) {
  let item = event.item;
  // Capture the action id.
  let id = event.action.id;

  if (id === "information") {
    window.open(item.layer.url);
  }
});

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.