import { createAttributeTableTemplateFromLayer, createAttributeTableElementsFromColumns, createNestedAttributeTableElementFromColumn, createTableTemplateFromLayer, createTableTemplateFromAttributeTableTemplate } from "@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

Function

Utility method which creates a basic AttributeTableTemplate based on the provided layer.

Signature
createAttributeTableTemplateFromLayer (params: CreateTemplateParameters): Promise<AttributeTableTemplate>

Parameters

ParameterTypeDescriptionRequired
params

Parameters controlling the generation of the AttributeTableTemplate.

Returns
Promise<AttributeTableTemplate>

A promise that resolves to a newly generated AttributeTableTemplate.

createAttributeTableElementsFromColumns

Function

Utility method which creates an array of column elements based on the provided columns.

Signature
createAttributeTableElementsFromColumns (columns: FeatureTableSupportedColumn[]): AttributeTableElementUnion[]

Parameters

ParameterTypeDescriptionRequired
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

Function

Method which creates a nested column element based on the provided column.

Signature
createNestedAttributeTableElementFromColumn (column: FeatureTableSupportedColumn): NestedAttributeTableElementUnion | null | undefined

Parameters

ParameterTypeDescriptionRequired
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

Function

Method which creates a basic TableTemplate based on the provided layer.

Signature
createTableTemplateFromLayer (params: CreateTemplateParameters): Promise<TableTemplate>

Parameters

ParameterTypeDescriptionRequired
params

Parameters controlling the generation of the TableTemplate.

Returns
Promise<TableTemplate>

A promise that resolves to a newly generated TableTemplate.

createTableTemplateFromAttributeTableTemplate

Function

Method which creates a TableTemplate based on the provided AttributeTableTemplate.

Signature
createTableTemplateFromAttributeTableTemplate (params: CreateTableTemplateFromAttributeTableTemplateParameters): Promise<TableTemplate>

Parameters

ParameterTypeDescriptionRequired
params

Parameters controlling the generation of the TableTemplate.

Returns
Promise<TableTemplate>

A promise that resolves to a newly generated TableTemplate.

createColumnTemplatesFromElements

Function

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

ParameterTypeDescriptionRequired
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

Function

Method which creates an array of column templates based on the provided columns.

Signature
createColumnTemplatesFromColumns (columns: FeatureTableSupportedColumn[]): SupportedColumnTemplates[]

Parameters

ParameterTypeDescriptionRequired
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

Function

Method which creates a nested column template based on the provided column.

Signature
createNestedColumnTemplateFromColumn (column: FeatureTableSupportedColumn): GroupColumnSupportedTemplates | null | undefined

Parameters

ParameterTypeDescriptionRequired
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

Function

Method which creates a nested column template based on the provided element and orderByFields.

Signature
createNestedColumnTemplateFromElement (element: AttributeTableElementUnion, orderByFields: AttributeTableFieldOrder[]): GroupColumnSupportedTemplates | null | undefined

Parameters

ParameterTypeDescriptionRequired
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

Function

Determines if a provided template is a TableTemplate.

Signature
isTableTemplate (template: unknown): template is TableTemplate

Parameters

ParameterTypeDescriptionRequired
template

The template to check.

Returns
template is TableTemplate

Returns true if the template is a TableTemplate, otherwise returns false.

isAttributeTableTemplate

Function

Determines if a provided template is an attribute table template.

Signature
isAttributeTableTemplate (template: unknown): template is AttributeTableTemplate

Parameters

ParameterTypeDescriptionRequired
template

The template to check.

Returns
template is AttributeTableTemplate

Returns true if the template is an attribute table template, otherwise returns false.

syncAttributeTableTemplateWithTable

Function

Method which syncs an attribute table template with the provided FeatureTable.

Signature
syncAttributeTableTemplateWithTable (table: FeatureTable, template: AttributeTableTemplate, includeHiddenColumns?: boolean): AttributeTableTemplate

Parameters

ParameterTypeDescriptionRequired
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

Function

Method which syncs an AttributeTableTemplate with the provided columns and sort orders.

Signature
syncAttributeTableTemplateWithColumns (template: AttributeTableTemplate, columns: FeatureTableSupportedColumn[], activeSortOrders: ColumnSortOrder[], includeHiddenColumns?: boolean): AttributeTableTemplate

Parameters

ParameterTypeDescriptionRequired
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.