TableListViewModel

require(["esri/widgets/TableList/TableListViewModel"], function(TableListVM) { /* code goes here */ });
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

NameTypeSummaryObject
ListItemCreatedHandler

Specifies a function that accesses each ListItem.

more details
more detailsTableListViewModel
Map|WebMap

A reference to the map containing the tables.

more details
more detailsTableListViewModel
String

The view model's state.

more details
more detailsTableListViewModel
Collection<ListItem>

The collection of table ListItems displayed within the widget.

more details
more detailsTableListViewModel

Property Details

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.

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:

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

NameTypeSummaryObject
{action: ActionButton,ActionToggle,item: ListItem}

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

more details
more detailsTableListViewModel

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.

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);
  }
});

API Reference search results

NameTypeModule
Loading...