import AttributeTableTemplate from "@arcgis/core/tables/AttributeTableTemplate.js";const AttributeTableTemplate = await $arcgis.import("@arcgis/core/tables/AttributeTableTemplate.js");- Inheritance:
- AttributeTableTemplate→
Accessor
- Since
- ArcGIS Maps SDK for JavaScript 4.31
An AttributeTableTemplate manages the configuration of how the FeatureTable widget displays its columns. This template allows you to define properties such as visibility, order, and sorting of the table's columns. It can be applied directly to a FeatureLayer.attributeTableTemplate, CSVLayer.attributeTableTemplate, GeoJSONLayer.attributeTableTemplate, CatalogFootprintLayer.attributeTableTemplate, SubtypeSublayer.attributeTableTemplate, a FeatureTable.attributeTableTemplate, or FeatureTable's view model. The AttributeTableTemplate consists of various elements that represent specific types of columns in a table. It can be serialized to JSON, enabling the persistence of the table's configuration. This feature facilitates easy sharing and reuse of table configurations across different applications.
Tables can be created with a variety of elements, including:
- AttributeTableFieldElement: Represents a column within the table that represents an individual field.
- AttributeTableAttachmentElement: Represents a column within the table that represents an attachment.
- AttributeTableRelationshipElement: Represents a column within the table that represents a relationship.
- AttributeTableGroupElement: Represents a group of
field,relationship, orattachmentelements in the table.
If a table is configured using another application such as Map Viewer, the resulting saved layer or web map item's JSON will contain a attributeTableInfo object.
Considerations
The layers that honor the attributeTableTemplate property are:
CatalogFootprintLayer
CSVLayer
FeatureLayer
GeoJSONLayer
MapImageLayer (sublayer)
SubtypeSublayer
SceneLayer
This class differs from TableTemplate. The TableTemplate class provides more fine-grained control over how the table is rendered within an application by offering more advanced configurations such as custom cell rendering, column formatting, and more. TableTemplate is useful for application-level development that remains within an application. Use AttributeTableTemplate to access the table's settings across different applications since they can be saved within a webmap or layer. Please refer to the TableTemplate documentation for more information.
The FeatureTable prioritizes the table's configurations in the following order:
- The TableTemplate defined in the FeatureTable.
- The FeatureTable.attributeTableTemplate defined in the FeatureTable.
- The
attributeTableTemplatedefined in the layer or standalone table. - Default columns are generated based on the layer's fields if no table templates exist.
Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
| Property | Type | Class |
|---|---|---|
declaredClass readonly inherited | ||
| | ||
| |
elements
- Type
- AttributeTableElementType[] | null | undefined
An array of attribute table element objects that represent an ordered list of table elements.
Table elements are designed to allow the table author the ability to define the layout for fields when displaying and/or editing data.
Nested group table elements are not supported.
orderByFields
- Type
- AttributeTableFieldOrder[] | null | undefined
An Array of AttributeTableFieldOrder objects indicating the records' sort order.
Methods
fromJSON
- Signature
-
fromJSON (json: any): any
Creates a new instance of this class and initializes it with values from a JSON object
generated from an ArcGIS product. The object passed into the input json
parameter often comes from a response to a query operation in the REST API or a
toJSON()
method from another ArcGIS product. See the Using fromJSON()
topic in the Guide for details and examples of when and how to use this function.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| json | A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects. | |
- Returns
- any
Returns a new instance of this class.
clone
- Signature
-
clone (): AttributeTableTemplate
Creates a deep clone of the AttributeTableTemplate class.
- Returns
- AttributeTableTemplate
A deep clone of the AttributeTableTemplate instance.
toJSON
- Signature
-
toJSON (): any
Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.
- Returns
- any
The ArcGIS portal JSON representation of an instance of this class.