Columns
configurationThe configuration of the grid columns. An array of JavaScript objects or strings. JavaScript objects are interpreted as column configurations. Strings are interpreted as the field to which the column is bound. The grid will create a column for every item of the array.
If this setting is not specified the grid will create a column for every field of the data item.
columns
Arraycolumns.aggregates
ArrayThe aggregate(s) which are calculated when the grid is grouped by the columns field. The supported aggregates are "average", "count", "max", "min" and "sum".
columns.attributes
Object|FunctionHTML attributes of the table cell (<td>) rendered for the column.
HTML attributes which are JavaScript keywords (e.g. class) must be quoted.
columns.columnMenu
BooleanIf set to false the column menu will not be rendered for the specific column.
Default: true
columns.columns
ArrayThe columns which should be rendered as child columns under this group column header.
**Note that group column cannot be data bound and supports limited number of bound column settings - such as title, headerTemplate, locked
columns.command
String|ArrayThe configuration of the column command(s). If set the column would display a button for every command. Commands can be custom or built-in ("edit" or "destroy").
The "edit" built-in command switches the current table row in edit mode.
The "destroy" built-in command removes the data item to which the current table row is bound.
Custom commands are supported by specifying the click option.
The built-in "edit" and "destroy" commands work only if editing is enabled via the editable option. The "edit" command supports "inline" and "popup" editing modes.
columns.dataSource
Object|kendo.data.DataSourceThe data source of the values for the foreign key columns. Can be a JavaScript object which represents a valid data source configuration or an existing kendo.data.DataSource instance.
Note: When the dataSource property is set one should also set the dataTextField and dataValueField.
columns.dataTextField
StringThe data text field of the foreign key item.
columns.dataValueField
StringThe data value field of the foreign key item.
columns.draggable
BooleanIf set to true a draghandle will be rendered and the user could reorder the rows by dragging the row via the drag handle. If the selectable option is enabled for rows only selected rows will can be dragged and reordered.
Note that the reordering operation is only a client-side operation and it does not reflect the order of any data that is bound to the server.
Default: false
columns.editable
FunctionThe JavaScript function executed when the cell/row is about to be opened for edit. The result returned will determine whether an editor for the column will be created.
columns.editor
String|FunctionProvides a way to specify a custom editing UI for the column. Use the container parameter to create the editing UI.
The editing UI should contain an element whose
nameHTML attribute is set as the column field.
Validation settings defined in the
model.fieldsconfiguration will not be applied automatically. In order the validation to work, the developer is responsible for attaching the corresponding validation attributes to the editor input thedata-bindattribute is whitespace sensitive. In case the custom editor is a widget, the developer should customize the validation warning tooltip position in order to avoid visual issues.
When used as String, defines the editor widget type. For further info check the Form API: field
The jQuery object representing the container element.
The name of the field to which the column is bound.
The column title.
The model instance to which the current table row is bound.
The object representing the editor options.
Specifies the adaptive rendering of the editor component.
The editor component size.
columns.editorOptions
ObjectDefines the widget configuration when one is initialized as editor for the column (or the widget defined in items.editor). For further info check the Form API: field.
columns.encoded
BooleanIf set to true the column value will be HTML-encoded before it is displayed. If set to false the column value will be displayed as is. By default the column value is HTML-encoded.
Default: true
columns.exportable
Boolean|ObjectIf the column isn't visible, the
exportableproperty must be set totrueexplicitly.
If set to false the column will be excluded from the exported Excel/PDF files.
Can be set to a JavaScript object which specifies whether the column should be exported per format.
Default: true
columns.field
StringThe field to which the column is bound. The value of this field is displayed in the column's cells during data binding. Only columns that are bound to a field can be sortable or filterable. The field name should be a valid Javascript identifier and should contain only alphanumeric characters (or "$" or "_"), and may not start with a digit.
columns.filterable
Boolean|ObjectIf set to true a filter menu will be displayed for this column when filtering is enabled. If set to false the filter menu will not be displayed. By default a filter menu is displayed
for all columns when filtering is enabled via the filterable option.
Can be set to a JavaScript object which represents the filter menu configuration.
Default: true
columns.footerAttributes
ObjectHTML attributes of the column footer. The footerAttributes option can be used to set the HTML attributes of that cell.
HTML attributes which are JavaScript keywords (e.g. class) must be quoted.
columns.footerTemplate
String|FunctionThe template which renders the footer table cell for the column.
The fields which can be used in the template are:
- average - the value of the "average" aggregate (if specified)
- count - the value of the "count" aggregate (if specified)
- max - the value of the "max" aggregate (if specified)
- min - the value of the "min" aggregate (if specified)
- sum - the value of the "sum" aggregate (if specified)
- data - provides access to all available aggregates, e.g.
data.fieldName1.sumordata.fieldName2.average
If the grid is bound using source binding, it will initially be assigned with an empty dataSource without any aggregates. In order to avoid a JavaScript error for an undefined aggregate when the footer is rendered with the empty dataSource, you should check if the field is defined in the template data before accessing the value. If no groups are specified for the actual dataSource, then you will also need to use the field name to access the aggregate value.
columns.format
StringThe format that is applied to the value before it is displayed.
Takes the form "{0:format}" where "format" can be a:
The kendo.format function is used to format the value.
columns.groupFooterTemplate
String|FunctionThe template which renders the group footer for the corresponding column. By default the group footer is not displayed. The group footer will always appear as long as at least one column has a defined groupFooterTemplate.
The fields which can be used in the template are:
- average - the value of the "average" aggregate (if specified)
- count - the value of the "count" aggregate (if specified)
- max - the value of the "max" aggregate (if specified)
- min - the value of the "min" aggregate (if specified)
- sum - the value of the "sum" aggregate (if specified)
- data - provides access to all available aggregates, e.g.
data.fieldName1.sumordata.fieldName2.average - group - provides information for the current group. An object with three fields -
field,valueanditems.itemsfield contains the data items for current group. Returns groups if the data items are grouped (in case there are child groups)
Important
If the template is declared as a function the group field is accessible only through the data field, e.g.
data.fieldName1.group.value.
columns.groupHeaderColumnTemplate
String|FunctionIntroduced in the Kendo UI 2018 R3 release.
The template which renders the content for specific column in the group header when the grid is grouped by the column field.
Note: The columns.groupHeaderTemplate has a higher priority than columns.groupHeaderColumnTemplate. If columns.groupHeaderTemplate is defined for the current group column it will take precedence over the columns.groupHeaderColumnTemplate setting of the currently first visible column. See Group Templates for more details on how this can be useful.
The fields which can be used in the template are:
- average - the value of the "average" aggregate (if specified)
- count - the value of the "count" aggregate (if specified)
- max - the value of the "max" aggregate (if specified)
- min - the value of the "min" aggregate (if specified)
- sum - the value of the "sum" aggregate (if specified)
- data - provides access to all available aggregates, e.g.
data.fieldName1.sumordata.fieldName2.average - group - provides information for the current group. An object with three fields -
field,valueanditems.itemsfield contains the data items for current group. Returns groups if the data items are grouped (in case there are child groups)
Important
If the template is declared as a function the group field is accessible only through the data field, e.g.
data.fieldName1.group.value.
columns.groupHeaderTemplate
String|FunctionThe template which renders the group header when the grid is grouped by the column field. By default the name of the field and the current group value is displayed.
The fields which can be used in the template are:
- value - the current group value
- field - the current group field
- average - the value of the "average" aggregate (if specified)
- count - the value of the "count" aggregate (if specified)
- max - the value of the "max" aggregate (if specified)
- min - the value of the "min" aggregate (if specified)
- sum - the value of the "sum" aggregate (if specified)
- aggregates - provides access to all available aggregates, e.g.
aggregates.fieldName1.sumoraggregates.fieldName2.average - items - the data items for current group. Returns groups if the data items are grouped (in case there are child groups)
Important
To use aggregates from other fields in the
column.groupHeaderTemplateadd them to the othercolumns.aggregates.
columns.groupable
Boolean|ObjectIf set to false the user will not be able to group the grid by this column (requires Grid groupable property to be enabled). By default all columns are groupable.
Default: true
columns.headerAttributes
ObjectHTML attributes of the column header. The grid renders a table header cell (<th>) for every column. The headerAttributes option can be used to set the HTML attributes of that th.
HTML attributes which are JavaScript keywords (e.g. class) must be quoted.
columns.headerTemplate
String|Functioncolumns.hidden
BooleanIf set to true the column will not be displayed in the grid. By default all columns are displayed.
Default: false
columns.hideOnGroup
BooleanIf set to true the column will be hidden when the grid is groupd via user iteraction. The column will be displayed again if iteraction to ungroup by it is performed.
Default: false
columns.lockable
BooleanIf set to false the column will remain in the side of the grid into which its own locked configuration placed it.
This option is meaningful when the grid has columns which are configured with a locked value. Setting it explicitly to
falsewill
prevent the user from locking or unlocking this column using the user interface.
Default: true
columns.locked
BooleanIf set to true the column will be displayed as locked (frozen) in the grid. Also see Locked Columns help section for additional information.
Important: Row template and detail features are not supported in combination with column locking. If multi-column headers are used, it is possible to lock (freeze) a column at the topmost level only.
Default: false
columns.media
StringSets the condition that needs to be satisfied for a column to remain visible. The property accepts valid strings for the matchMedia browser API (assuming it is supported by the browser) and toggles the visibility of the columns based on the media queries.
The hidden option takes precedence over media. This option cannot be used with minScreenWidth at the same time.
Also accepts the device identifiers that are available in Bootstrap 4:
xsis equivalent to"(max-width: 576px)"smis equivalent to"(min-width: 576px)"mdis equivalent to"(min-width: 768px)"lgis equivalent to"(min-width: 992px)"xlis equivalent to"(min-width: 1200px)"
columns.menu
BooleanIf set to true the column will be visible in the grid column menu. By default the column menu includes all data-bound columns (ones that have their field set).
The pixel screen width below which the user will not be able to resize the column via the UI.
This option is meaningful when the grid is set as resizable.
columns.minScreenWidth
NumberThe pixel screen width below which the column will be hidden. The setting takes precedence over the hidden setting,
so the two should not be used at the same time.
columns.pinnable
BooleanIf set to true a pin/unpin icon button will be rendered in the column cells, allowing users to pin or unpin individual rows by clicking it. Clicking the icon opens a menu with options to pin the row to the top, pin to the bottom, or unpin it.
Important: The
pinnableoption on the Grid must also be set to enable row pinning.
Default: false
columns.resizable
BooleanIf set to false the column will become non-resizable, while all the other columns remaining resizable in the grid component.
In order for this property to work, grid's resizable property must be set to true
Default: true
columns.selectable
BooleanIf set to true the grid will render a select column with checkboxes in each cell, thus enabling multi-row selection. The header checkbox allows users to select/deselect all the rows on the current page. The change event is fired when a row is selected.
Setting the
columns.selectabletotrueoverrides theselectable.modeconfiguration property if it is set to"single".
More about the Grid Selection feature you can find in this documentation article.
Default: false
columns.sortable
Boolean|Objectcolumns.stickable
BooleanIf set to true the user will be able to stick or unstick the column from the column menu.
Default: false
columns.sticky
BooleanIf set to true the column will be displayed as sticky in the grid. Also see Sticky Columns help section for additional information.
Important: Row template and detail features are not supported in combination with sticky columns. If multi-column headers are used, it is possible to stick a column at the topmost level only.
Default: false
columns.template
String|FunctionThe template which renders the column content. The grid renders table rows (<tr>) which represent the data source items.
Each table row consists of table cells (<td>) which represent the grid columns. By default the HTML-encoded value of the field is displayed in the column.
Use the
templateto customize the way the column displays its value.
For additional and more complex examples that utilize column templates, visit the Knowledge Base documentation, and use the following search terms:
- column template
- grid column template
- Column Template | Kendo UI Grid
columns.title
StringThe text that is displayed in the column header cell. If not set the field is used.
Note: Column titles should not contain HTML entities or tags. If such exist, they should be encoded.
columns.values
ArrayAn array of values that will be displayed instead of the bound value. Each item in the array must have a text and value fields.
Use the
valuesoption to display user-friendly text instead of database values.
columns.width
String|NumberThe width of the column. Numeric values are treated as pixels. The width option supports the fundamental measuring units. For instance:
pxsets the width in pixelscmsets the width in centimetersmmsets the width in millimeters%sets the width relative to the grid's element widthemsets the width relative to the font-size of the grid's element widthremsets the width relative to font-size of the root element
For more important information, please refer to Column Widths.
Grid options, including column widths, can be set programmatically after Grid initialization with the setOptions method.