require(["esri/widgets/TableList/TableListViewModel"], (TableListVM) => { /* code goes here */ });
import TableListVM from "@arcgis/core/widgets/TableList/TableListViewModel.js";
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 |
---|---|---|---|
Boolean | Whether to provide an indication if a layer is being published in the TableList. | TableListViewModel | |
ListItemCreatedHandler | Specifies a function that accesses each ListItem. | TableListViewModel | |
Map|WebMap | A reference to the map containing the tables. | TableListViewModel | |
String | The view model's state. | TableListViewModel | |
Collection<ListItem> | The collection of table ListItems displayed within the widget. | TableListViewModel |
Property Details
-
checkPublishStatusEnabled
checkPublishStatusEnabled Boolean
Since: ArcGIS Maps SDK for JavaScript 4.25TableListViewModel since 4.17, checkPublishStatusEnabled added at 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
ifcheckPublishStatusEnabled
isfalse
.- Default Value:false
-
listItemCreatedFunction
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
state Stringreadonly
-
The view model's state.
Possible Values:"loading"|"ready"|"disabled"
- Default Value:disabled
-
tableItems
tableItems Collection<ListItem>readonly
-
The collection of table ListItems displayed within the widget.
Type Definitions
-
Function definition for the listItemCreatedFunction property.
Parametersevent ObjectAn object containing a list item created by the TableList.
Specificationitem 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. |
TableListViewModel |
Event Details
-
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.
ExampletableList.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); } });