TableListViewModel
require(["esri/widgets/TableList/TableListViewModel"], function(TableListVM) { /* code goes here */ });
esri/widgets/TableList/TableListViewModel
const tableList = new TableList({
viewModel: { // autocasts as new TableListViewModel
map: map // specify the map containing the tables
}
});
Property Overview
Name | Type | Summary | Object | |
---|---|---|---|---|
ListItemCreatedHandler | Specifies a function that accesses each ListItem. more details | more details | TableListViewModel | |
Map|WebMap | A reference to the map containing the tables. more details | more details | TableListViewModel | |
String | The view model's state. more details | more details | TableListViewModel | |
Collection<ListItem> | The collection of table ListItems displayed within the widget. more details | more details | TableListViewModel |
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 ObjectAn object containing a list item created by the TableList.
Specification:item ListItemA 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 | 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:
- action ActionButton|ActionToggle
The action clicked by the user.
item ListItemAn 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); } });