Columns
Column Class
Property
Type
Description
DataType
string
The data type for the column. Standard values include string
, number
, boolean
, guid
, html
. Depending on the data service, this may also be a custom value.
Format
string | function
The formatting to be used for values in the column. Valid values are C[N], P[N], N[N] where [N] is the number of decimal places. Use C
for currency, P
for percentage, and N
to use numeric thousands separators. A custom function can also be used to format values. Visit Working with DataTables Select and Calculate for examples.
Name
string
The system name of the column. This is often times the name of the source field used in the data service.
Title
string
The descriptive name of the column. This will often times be used as the label for values in UI components.
Column Methods
Name
Description
columnNameArray
Returns an array of the Name
for each column in a data table.
columnTitleArray
Returns an array of the Title
for each column in a data table.
getColumn(name)
Returns the column with the column name
.
removeColumn(name)
Removes the column name
from a data table.
renameColumn(oldName, newName)
Changes the name of the column from oldName
to newName
. This will also change the property with the same name on all rows in the data table.
AddColumn Methods
Use the following methods with the addColumn
method to create a new column.
Name
Description
addColumn(name)
Adds a new column with the Name
property set to name
.
calc
Creates the new column as a calculated column. Note, as new rows are added or removed, this calculation will be dynamically re-applied. Visit Working with DataTables Select and Calculate for examples.
format(format)
Format the new column using the specification in format
. This can also be a custom function. See the Format property of the Column class above for details.
index
Creates a calculated column that sets each row to the index position of the row within all rows in the data table. Note, as new rows are added or removed, this calculation will be dynamically re-applied.
title(title)
Sets the Title
property of the new column.
type(type)
Sets the DataType
property of the new column.
value(value)
Sets the value for all rows in the data table to value
for the new column.
The following creates a new column on a data table calledemp_position
with a display title of Position
.
Visit Working with DataTables Columns for detailed examples of using column data table methods.
Last updated