import { createAttributeTableTemplateFromLayer, createAttributeTableElementsFromColumns, createNestedAttributeTableElementFromColumn, createTableTemplateFromLayer, createTableTemplateFromAttributeTableTemplate } from "@arcgis/core/tables/support/templateUtils.js";const { createAttributeTableTemplateFromLayer, createAttributeTableElementsFromColumns, createNestedAttributeTableElementFromColumn, createTableTemplateFromLayer, createTableTemplateFromAttributeTableTemplate } = await $arcgis.import("@arcgis/core/tables/support/templateUtils.js");- Since
- ArcGIS Maps SDK for JavaScript 5.1
Various utility methods for creating and updating templates used by the FeatureTable component.
Functions
createAttributeTableTemplateFromLayer
Utility method which creates a basic AttributeTableTemplate based on the provided layer.
- Signature
-
createAttributeTableTemplateFromLayer (params: CreateTemplateParameters): Promise<AttributeTableTemplate>
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| params | Parameters controlling the generation of the AttributeTableTemplate. | |
- Returns
- Promise<AttributeTableTemplate>
A promise that resolves to a newly generated AttributeTableTemplate.
createAttributeTableElementsFromColumns
Utility method which creates an array of column elements based on the provided columns.
- Signature
-
createAttributeTableElementsFromColumns (columns: FeatureTableSupportedColumn[]): AttributeTableElementUnion[]
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| columns | An array of columns from which to generate attribute table elements. | |
- Returns
- AttributeTableElementUnion[]
An array of attribute table elements generated from the provided columns.
createNestedAttributeTableElementFromColumn
Method which creates a nested column element based on the provided column.
- Signature
-
createNestedAttributeTableElementFromColumn (column: FeatureTableSupportedColumn): NestedAttributeTableElementUnion | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| column | A column from which to generate a nested attribute table element (excludes group elements). | |
- Returns
- NestedAttributeTableElementUnion | null | undefined
An attribute table element generated from the provided column, or undefined if the column is hidden or of an unsupported type.
createTableTemplateFromLayer
Method which creates a basic TableTemplate based on the provided layer.
- Signature
-
createTableTemplateFromLayer (params: CreateTemplateParameters): Promise<TableTemplate>
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| params | Parameters controlling the generation of the TableTemplate. | |
- Returns
- Promise<TableTemplate>
A promise that resolves to a newly generated TableTemplate.
createTableTemplateFromAttributeTableTemplate
Method which creates a TableTemplate based on the provided AttributeTableTemplate.
- Signature
-
createTableTemplateFromAttributeTableTemplate (params: CreateTableTemplateFromAttributeTableTemplateParameters): Promise<TableTemplate>
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| params | Parameters controlling the generation of the TableTemplate. | |
- Returns
- Promise<TableTemplate>
A promise that resolves to a newly generated TableTemplate.
createColumnTemplatesFromElements
Method which creates an array of column templates based on the provided elements and orderByFields.
- Signature
-
createColumnTemplatesFromElements (elements: AttributeTableElementUnion[] | null | undefined, orderByFields: AttributeTableFieldOrder[]): SupportedColumnTemplates[]
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| elements | An array of attribute table elements from which to generate column templates. | | |
| orderByFields | An array of attribute table field order objects which determine the sort order of columns in the table. | |
- Returns
- SupportedColumnTemplates[]
An array of column templates generated from the provided elements and orderByFields.
createColumnTemplatesFromColumns
Method which creates an array of column templates based on the provided columns.
- Signature
-
createColumnTemplatesFromColumns (columns: FeatureTableSupportedColumn[]): SupportedColumnTemplates[]
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| columns | An array of columns from which to generate attribute table elements. | |
- Returns
- SupportedColumnTemplates[]
An array of column templates generated from the provided columns.
createNestedColumnTemplateFromColumn
Method which creates a nested column template based on the provided column.
- Signature
-
createNestedColumnTemplateFromColumn (column: FeatureTableSupportedColumn): GroupColumnSupportedTemplates | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| column | A column from which to generate a nested column template (excludes group columns). | |
- Returns
- GroupColumnSupportedTemplates | null | undefined
A column template generated from the provided column, or undefined if the column is hidden or of an unsupported type.
createNestedColumnTemplateFromElement
Method which creates a nested column template based on the provided element and orderByFields.
- Signature
-
createNestedColumnTemplateFromElement (element: AttributeTableElementUnion, orderByFields: AttributeTableFieldOrder[]): GroupColumnSupportedTemplates | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| element | An attribute table element from which to generate a nested column template (excludes group elements). | | |
| orderByFields | An array of attribute table field order objects which determine the sort order of columns in the table. | |
- Returns
- GroupColumnSupportedTemplates | null | undefined
A column template generated from the provided element and orderByFields, or undefined if the element is of an unsupported type.
isTableTemplate
Determines if a provided template is a TableTemplate.
- Signature
-
isTableTemplate (template: unknown): template is TableTemplate
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| template | The template to check. | |
- Returns
- template is TableTemplate
Returns true if the template is a TableTemplate, otherwise returns false.
isAttributeTableTemplate
Determines if a provided template is an attribute table template.
- Signature
-
isAttributeTableTemplate (template: unknown): template is AttributeTableTemplate
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| template | The template to check. | |
- Returns
- template is AttributeTableTemplate
Returns true if the template is an attribute table template, otherwise returns false.
syncAttributeTableTemplateWithTable
Method which syncs an attribute table template with the provided FeatureTable.
- Signature
-
syncAttributeTableTemplateWithTable (table: FeatureTable, template: AttributeTableTemplate, includeHiddenColumns?: boolean): AttributeTableTemplate
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| table | The FeatureTable to synchronize with the AttributeTableTemplate. | | |
| template | The AttributeTableTemplate to sync with the table. | | |
| includeHiddenColumns | Indicates whether to include hidden columns in the synced template. Default is true. | |
- Returns
- AttributeTableTemplate
The synced attribute table template.
syncAttributeTableTemplateWithColumns
Method which syncs an AttributeTableTemplate with the provided columns and sort orders.
- Signature
-
syncAttributeTableTemplateWithColumns (template: AttributeTableTemplate, columns: FeatureTableSupportedColumn[], activeSortOrders: ColumnSortOrder[], includeHiddenColumns?: boolean): AttributeTableTemplate
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| template | The AttributeTableTemplate to sync with the columns. | | |
| columns | An array of columns with which to sync the attribute table template. | | |
| activeSortOrders | An array of attribute table field order objects which determine the current sort order of table columns. | | |
| includeHiddenColumns | Indicates whether to include hidden columns in the synced template. Default is true. | |
- Returns
- AttributeTableTemplate
The synced attribute table template.