Column

AMD: require(["esri/widgets/FeatureTable/Grid/Column"], (Column) => { /* code goes here */ });
ESM: import Column from "@arcgis/core/widgets/FeatureTable/Grid/Column.js";
Class: esri/widgets/FeatureTable/Grid/Column
Inheritance: Column→Accessor
Subclasses: FieldColumn , GroupColumn
Since: ArcGIS Maps SDK for JavaScript 4.30

The Column class works with the FeatureTable and provides much of the underlying logic for column behavior. Column and its subclasses, ie. FieldColumn, GroupColumn, ActionColumn, AttachmentsColumn, and RelationshipColumn, contain information about the current table state after it has been rendered. This includes the column's header, cell content, and any associated menu items.

This class should be used for observing potential changes. Any configuration and changes to the columns should be handled via the TableTemplate and the ColumnTemplate class.

See also

Property Overview

Any properties can be set, retrieved or listened to. See the Watch for changes topic.
Show inherited properties Hide inherited properties
Name Type Summary Class

Indicates if the column width will automatically adjust to account for large content.

Column

The name of the class.

Accessor

Contains information describing the purpose of each column.

Column

Controls the sort order of the column.

Column

The sanitized description string, describing the purpose of each column.

Column

The sanitized label string safe for display in the header cell.

Column

The unique field name as defined by the data source.

Column

Controls the flex-grow property for the column.

Column

Custom function for rendering cell content that is called when the column is rendered in the table.

Column

Indicates if the the column is frozen in place at the beginning of the table.

Column

Indicates if the column is frozen in place at the end of the table.

Column

The string value indicating the icon displayed in the header cell of the column.

Column

Indicates the initial sort priority of the column when first rendered.

Column

Indicates whether the column is in an invalid state.

Column

The default label displayed in the column header cell.

Column

The element representing the field column's menu.

Column

Configuration options for the column's menu.

Column

Indicates whether the column's menu is currently open.

Column

Indicates whether the Column's menu will be displayed.

Column

Indicates whether the column is resizable.

Column

Indicates whether the column is sortable.

Column

The timeZone of the parent table widget.

Column

Aligns the columns cell content horizontally.

Column

Indicates cell content should be wrapped and displayed on multiple lines within the cell.

Column

The storage IANA time zone of the column.

Column

The visible elements of the column's associated FeatureTable.

Column

Width of the column in pixels.

Column

Property Details

autoWidth

Property
autoWidth Boolean

Indicates if the column width will automatically adjust to account for large content. The column ignores the current width property when autoWidth is true.

Default Value:false

declaredClass

Inherited
Property
declaredClass Stringreadonly
Inherited from Accessor

The name of the class. The declared class name is formatted as esri.folder.className.

description

Property
description String

Contains information describing the purpose of each column.

direction

Property
direction String |null

Controls the sort order of the column. This property will only be honored on one column in the FeatureTable widget. If direction is specified on more than one column in the same FeatureTable, it will only be honored on the column with the highest index.

This is used in combination with the initialSortPriority and FeatureTable.multiSortEnabled properties to set sorting functionality for multiple columns.

Possible Value Description
asc Sorts the column in ascending order.
desc Sorts the column in descending order.
null No sort is applied to the column.

Possible Values:"asc" |"desc"

effectiveDescription

Property
effectiveDescription String
Since: ArcGIS Maps SDK for JavaScript 4.31 Column since 4.30, effectiveDescription added at 4.31.

The sanitized description string, describing the purpose of each column.

effectiveLabel

Property
effectiveLabel String

The sanitized label string safe for display in the header cell. Defaults to using fieldName if a label is not defined on the column.

fieldName

Property
fieldName Stringreadonly

The unique field name as defined by the data source.

flexGrow

Property
flexGrow Number

Controls the flex-grow property for the column. When set to 0, cell width is fixed.

Default Value:1

formatFunction

Property
formatFunction FormatFunctionreadonly

Custom function for rendering cell content that is called when the column is rendered in the table. The function should return the formatted content to display within a table's cell. This can be a string, number, an HTML element, or equivalent node type (e.g. a Calcite component). If the content is an HTML element, it is appended to the root element. If the content is a string or number, it is set as the innerHTML of the root element. If the content is null, the root element is cleared. If the content is undefined, the root element is not modified. This property is useful when you want to customize the cell content. For example, you can use this property to create a custom cell renderer that displays a progress bar in the cell. The progress bar can be used to show the progress of a task.

Example
// The following example demonstrates how to use the formatFunction property to create a custom cell renderer that displays a progress bar in the cell. The progress bar can be used to show the progress of a task.
column.formatFunction = ({ column, feature, index, value })=> {
  const progress = document.createElement("progress");
  progress.max = 100;
  progress.value = value;
  return progress;
};

frozen

Property
frozen Booleanreadonly

Indicates if the the column is frozen in place at the beginning of the table. Column must be first in the FeatureTable's column's, or next to other frozen columns.

Default Value:false

frozenToEnd

Property
frozenToEnd Booleanreadonly

Indicates if the column is frozen in place at the end of the table. Column must be last in the FeatureTable's column's, or next to other columns with frozenToEnd set to true.

Default Value:false

icon

Property
icon String

The string value indicating the icon displayed in the header cell of the column.

initialSortPriority

Property
initialSortPriority Numberreadonly

Indicates the initial sort priority of the column when first rendered.

invalid

Property
invalid Boolean

Indicates whether the column is in an invalid state.

Default Value:undefined

label

Property
label String

The default label displayed in the column header cell.

Property
menu HTMLElementreadonly

The element representing the field column's menu.

Property
menuConfig ColumnTableMenuConfigreadonly

Configuration options for the column's menu.

FeatureTable.tableTemplate.

Property
menuIsOpen Booleanreadonly

Indicates whether the column's menu is currently open.

Property
menuIsVisible Booleanreadonly

Indicates whether the Column's menu will be displayed.

resizable

Property
resizable Booleanreadonly

Indicates whether the column is resizable.

Default Value:true

sortable

Property
sortable Boolean

Indicates whether the column is sortable.

Default Value:false

tableTimeZone

Property
tableTimeZone String
Since: ArcGIS Maps SDK for JavaScript 4.31 Column since 4.30, tableTimeZone added at 4.31.

The timeZone of the parent table widget.

textAlign

Property
textAlign String

Aligns the columns cell content horizontally.

Possible Values:"start" |"center" |"end"

Default Value:"start"

textWrap

Property
textWrap Boolean

Indicates cell content should be wrapped and displayed on multiple lines within the cell. Warning: this causes rows to expand when tall content is visible in the viewport. Scrolling tall cells into the viewport may cause the table to visually jump depending on the height of the expanding rows.

Default Value:false

visibleElements

Property
visibleElements VisibleElements

The visible elements of the column's associated FeatureTable.

width

Property
width Number |String

Width of the column in pixels. If providing value as a string, the string must include "px" suffix. This value is only honored when there are enough columns to fill the viewport, or flexGrow has been set to 0.

Default Value:200

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class

Adds one or more handles which are to be tied to the lifecycle of the object.

Accessor

Convenience method for closing the column menu.

Column

Emits an event on the instance.

Column

Indicates whether there is an event listener on the instance that matches the provided event name.

Column

Returns true if a named group of handles exist.

Accessor

Registers an event handler on the instance.

Column

Convenience method for opening the column menu.

Column

Removes a group of handles owned by the object.

Accessor

Convenience method for sorting the current column.

Column

Method Details

addHandles

Inherited
Method
addHandles(handleOrHandles, groupKey)
Inherited from Accessor

Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

this.addHandles(handle);

// Destroy the object
this.destroy();
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

closeMenu

Method
closeMenu()

Convenience method for closing the column menu.

emit

Method
emit(type, event){Boolean}

Emits an event on the instance. This method should only be used when creating subclasses of this class.

Parameters
type String

The name of the event.

event Object
optional

The event payload.

Returns
Type Description
Boolean true if a listener was notified

hasEventListener

Method
hasEventListener(type){Boolean}

Indicates whether there is an event listener on the instance that matches the provided event name.

Parameter
type String

The name of the event.

Returns
Type Description
Boolean Returns true if the class supports the input event.

hasHandles

Inherited
Method
hasHandles(groupKey){Boolean}
Inherited from Accessor

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type Description
Boolean Returns true if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}

on

Method
on(type, listener){Object}

Registers an event handler on the instance. Call this method to hook an event with a listener.

Parameters

An event or an array of events to listen for.

listener Function

The function to call when the event fires.

Returns
Type Description
Object Returns an event handler with a remove() method that should be called to stop listening for the event(s).
Property Type Description
remove Function When called, removes the listener from the event.
Example
view.on("click", function(event){
  // event is the event handle returned after the event fires.
  console.log(event.mapPoint);
});

openMenu

Method
openMenu()

Convenience method for opening the column menu. This has no effect if the menu is not visible or has no menu items. It follows the direction pattern of ascending, to descending, then no sort order.

removeHandles

Inherited
Method
removeHandles(groupKey)
Inherited from Accessor

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A group key or an array or collection of group keys to remove.

Example
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

sort

Method
sort()

Convenience method for sorting the current column. It has no effect if column sorting is disabled.

Type Definitions

ColumnTableMenuConfig

Type Definition
ColumnTableMenuConfig Object
Properties
disabled Boolean
optional

Indicates whether the menu is disabled. Default value is false.

The menu items within the table menu.

open Boolean
optional

Indicates whether the menu is open. Default value is false.

icon String
optional

The string value indicating the icon displayed in the header cell of the column.

selectionMode String
optional

The selection mode of the menu items.

Possible Values:"none"|"single"|"multiple"

FormatFunction

Type Definition
FormatFunction(params){String |Number |HTMLElement |null}

Custom function for rendering cell content. Accepts a string, number, an HTML element or equivalent node type (e.g. a Calcite component).

Parameters
Specification
params Object

An object containing information about the associated row and feature.

Specification
attachments AttachmentInfo[]

(Since 4.31) A reference to attachments for the associated feature.

column Column

A reference to this specific Column.

feature Graphic

A reference to the feature represented by the associated row.

index Number

Index of the associated row being rendered.

relatedRecords RelatedRecordInfo[]

(Since 4.31) A reference to related records for the associated feature.

virtualIndex Number

(Since 4.31) Virtual index of the associated row being rendered. Unlike index, a row's virtualIndex changes as the table scrolls. The first row in the DOM has a virtualIndex of 0. As rows are added/removed from the DOM, the virtual index adjusts before it renders. This can help with performance when rendering large datasets.

Current projected value of the cell.

Returns
Type Description
String | Number | HTMLElement | null Formatted content to be displayed in the cell.

RelatedRecordInfo

Type Definition
RelatedRecordInfo Object

The related records for the associated feature used in the Columns's and FieldColumn's formatFunction.

Properties
relationshipId String
optional

The ID of the relationship defined in the data source.

count Number
optional

The number of related records associated with the feature.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.