import "@arcgis/map-components/components/arcgis-table-list";- Inheritance:
- ArcgisTableList→
PublicLitElement
- Since
- ArcGIS Maps SDK for JavaScript 4.28
The Table List component provides a way to display a list of tables associated with a Map. It is meant to be used with feature layer tables.
If a map contains feature layer tables, they will display within the component. Tables can also be added to the Map's tables collection. Any tables referenced in the map property will display in the component. If unsure of whether the layer is a table, check the feature layer's isTable property.
The ListItem API provides access to each table, allows the developer to configure actions related to the table, and allows the developer to add content to the item related to the table.
Known Limitations
- The TableList component is not supported with arcgis-scene.
Demo
Example
const tableListElement = document.createElement("arcgis-table-list");tableListElement.referenceElement = viewElement;tableListElement.slot = "top-left";viewElement.appendChild(tableListElement);
const layer = Layer.fromPortalItem({ // Loads a layer (table) from a portal item portalItem: { id: "add portal item id" }});
// Wait for the layer to loadawait layer.load()
// Check if the layer is a tableif (layer.isTable) { // Add the table to the map's tables collection viewElement.map.tables.add(layer);}Properties
| Property | Attribute | Type |
|---|---|---|
auto-destroy-disabled | ||
closed | ||
collapsed reflected | collapsed | |
drag-enabled | ||
filter-placeholder | ||
| ||
filter-text | ||
hide-status-indicators | ||
icon | Icon["icon"] | |
label | ||
| ||
| ||
min-drag-enabled-items | ||
min-filter-items | ||
reference-element | ||
| ||
selection-mode | "multiple" | "single" | "none" | "single-persist" | |
show-close-button | ||
show-collapse-button | ||
show-errors | ||
show-filter | ||
show-heading | ||
show-temporary-table-indicators | ||
state readonly | | |
tableItems readonly | | |
|
autoDestroyDisabled
- Type
- boolean
If true, the component will not be destroyed automatically when it is disconnected from the document. This is useful when you want to move the component to a different place on the page, or temporarily hide it. If this is set, make sure to call the destroy() method when you are done to prevent memory leaks.
- Attribute
- auto-destroy-disabled
- Default value
- false
closed
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.33
Indicates whether a component is closed. When true, the component will be hidden.
- Attribute
- closed
- Default value
- false
collapsed
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.29
Indicates whether the component is collapsed. When collapsed, only the collapse button and heading are displayed.
- See also
- Attribute
- collapsed
- Default value
- false
Example
tableListElement.collapsed = true; dragEnabled
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.29
Indicates whether list items may be reordered within the list by dragging and dropping. Drag won't be enabled until the number of list items is equal to or greater than than the value set set in minDragEnabledItems.
- See also
- Attribute
- drag-enabled
- Default value
- false
Example
tableListElement.dragEnabled = true; filterPlaceholder
- Type
- string
- Since
- ArcGIS Maps SDK for JavaScript 4.29
Placeholder text used in the filter input if showFilter is true.
- See also
- Attribute
- filter-placeholder
- Default value
- ""
Example
tableListElement.filterPlaceholder = "Filter layers"; filterPredicate
- Type
- FilterPredicate | null | undefined
- Since
- ArcGIS Maps SDK for JavaScript 4.32
Specifies a function to handle filtering list items.
Example
tableListElement.filterPredicate = (item) => item.title.toLowerCase().includes("streets"); filterText
- Type
- string
- Since
- ArcGIS Maps SDK for JavaScript 4.29
The value of the filter input text string if showFilter is true.
- See also
- Attribute
- filter-text
- Default value
- ""
Example
reactiveUtils.watch( () => tableListElement.filterText, (filterText) => console.log(filterText)); hideStatusIndicators
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
Indicates whether the status indicators will be displayed.
- Attribute
- hide-status-indicators
- Default value
- false
icon
- Type
- Icon["icon"]
Icon which represents the component. Typically used when the component is controlled by another component (e.g. by the Expand component).
- See also
- Attribute
- icon
- Default value
- "table"
listItemCreatedFunction
- 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 of the ListItem.
Example
tableListElement.listItemCreatedFunction = (event) => { const { item } = event; item.actionsSections = [ [ { title: "Open in feature table", icon: "table", id: "open-table" } ] ]; } map
- Since
- ArcGIS Maps SDK for JavaScript 4.34
A reference to a Map containing the tables. Set this property to access the underlying tables within the map.
- See also
minDragEnabledItems
- Type
- number
- Since
- ArcGIS Maps SDK for JavaScript 4.29
The minimum number of list items required to enable drag and drop reordering with dragEnabled.
- See also
- Attribute
- min-drag-enabled-items
- Default value
- 2
Example
tableListElement.dragEnabled = true;tableListElement.minDragEnabledItems = 5; minFilterItems
- Type
- number
- Since
- ArcGIS Maps SDK for JavaScript 4.29
The minimum number of list items required to display the showFilter input box.
- See also
- Attribute
- min-filter-items
- Default value
- 10
Example
tableListElement.showFilter = true;tableListElement.minFilterItems = 5; referenceElement
- Type
- ArcgisReferenceElement | string | undefined
By assigning the id attribute of the Map or Scene component to this property, you can position a child component anywhere in the DOM while still maintaining a connection to the Map or Scene.
- Attribute
- reference-element
selectedItems
- Type
- Collection<ListItem>
A collection of selected ListItems representing table list items selected by the user.
- See also
selectionMode
- Type
- "multiple" | "single" | "none" | "single-persist"
- Since
- ArcGIS Maps SDK for JavaScript 4.29
Specifies the selection mode. Selected items are available in the selectedItems property.
| Value | Description |
|---|---|
| multiple | Allows any number of items to be selected at once. This is useful when you want to apply an operation to multiple items at the same time. |
| none | Disables selection. Use this when you want to prevent selecting items. |
| single | Allows only one item to be selected at a time. If another item is selected, the previous selection is cleared. This is useful when you want to ensure that a maximum of one item is selected at a time. |
| single-persist | Allows only one item to be selected at a time and prevents de-selection. Once an item is selected, it remains selected until another item is selected. This is useful when you want to ensure that there is always exactly one selected item. |
- See also
- Attribute
- selection-mode
- Default value
- "none"
Example
tableListElement.selectionMode = "multiple"; showCloseButton
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
Indicates whether to display a close button in the header.
- Attribute
- show-close-button
- Default value
- false
showCollapseButton
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
Indicates whether to display a collapse button in the header.
- Attribute
- show-collapse-button
- Default value
- false
showErrors
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
Indicates whether to display layers with load errors.
- Attribute
- show-errors
- Default value
- false
showFilter
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
Indicates whether to display a filter input box when then number of list items is equal to or greater than the value set in TableList#minFilterItems, allowing users to filter tables by their title.
- Attribute
- show-filter
- Default value
- false
showHeading
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
Indicates whether to display the table list heading. The heading text is "Table List". The heading level can be set with the TableList#headingLevel.
- Attribute
- show-heading
- Default value
- false
showTemporaryTableIndicators
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
Indicates whether temporary table indicators will be displayed for tables with Layer#persistenceEnabled set to false. A temporary icon will be displayed on the near side of the table title.
- Attribute
- show-temporary-table-indicators
- Default value
- false
tableItems
- Type
- Collection<TableListListItem>
The collection of table ListItems displayed within the component.
view
- Type
- LinkChartView | MapView | SceneView | undefined
The view associated with the component.
Note: The recommended approach is to fully migrate applications to use map and scene components and avoid using MapView and SceneView directly. However, if you are migrating a large application from widgets to components, you might prefer a more gradual transition. To support this use case, the SDK includes this
viewproperty which connects a component to a MapView or SceneView. Ultimately, once migration is complete, the arcgis-table-list component will be associated with a map or scene component rather than using theviewproperty.
Methods
| Method | Signature |
|---|---|
componentOnReady inherited | componentOnReady(): Promise<this> |
destroy(): Promise<void> |
componentOnReady
- Signature
-
componentOnReady (): Promise<this>
Creates a promise that resolves once the component is fully loaded.
- Returns
- Promise<this>
Example
const arcgisTableList = document.querySelector("arcgis-table-list");document.body.append(arcgisTableList);await arcgisTableList.componentOnReady();console.log("arcgis-table-list is ready to go!");Events
| Name | Type |
|---|---|
| CustomEvent<{ name: "state"; }> | |
arcgisClose
arcgisClose: CustomEvent<void> - Since
- ArcGIS Maps SDK for JavaScript 4.33
Emitted when the component's close button is clicked.
arcgisPropertyChange
arcgisPropertyChange: CustomEvent<{ name: "state"; }> Emitted when the value of a property is changed. Use this to listen to changes to properties.
arcgisReady
arcgisReady: CustomEvent<void> Emitted when the component associated with a map or scene view is ready to be interacted with.
arcgisTriggerAction
arcgisTriggerAction: CustomEvent<TableListViewModelTriggerActionEvent> Emitted when an action is triggered on the component.