\Kendo\UI\GridColumn

A PHP class representing the column setting of GridColumns.

Methods

aggregates

The aggregate(s) which are calculated when the grid is grouped by the columns field. The supported aggregates are "average", "count", "max", "min" and "sum".

Returns

\Kendo\UI\GridColumn

Parameters

$value array

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->aggregates(array());
?>

attributes

HTML attributes of the table cell (

) rendered for the column.

Returns

\Kendo\UI\GridColumn

Parameters

$value |\Kendo\JavaScriptFunction

Example - using

<?php
$column = new \Kendo\UI\GridColumn();
$column->attributes(new ());
?>

Example - using \Kendo\JavaScriptFunction

<?php
$column = new \Kendo\UI\GridColumn();
$column->attributes(new \Kendo\JavaScriptFunction('function() { }'));
?>

columnMenu

If set to false the column menu will not be rendered for the specific column.

Returns

\Kendo\UI\GridColumn

Parameters

$value boolean

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->columnMenu(true);
?>

addCommandItem

Adds one or more GridColumnCommandItem to the GridColumn.

Returns

\Kendo\UI\GridColumn

Parameters

$value[, $value2, ...] \Kendo\UI\GridColumnCommandItem|array

Example - using \Kendo\UI\GridColumnCommandItem

<?php
$column = new \Kendo\UI\GridColumn();
$commandItem = new \Kendo\UI\GridColumnCommandItem();
$className = 'value';
$commandItem->className($className);
$column->addCommandItem($commandItem);
?>

Example - using array

<?php
$column = new \Kendo\UI\GridColumn();
$className = 'value';
$column->addCommandItem(array('className' => $className));
?>

Example - adding more than one GridColumnCommandItem

<?php
$column = new \Kendo\UI\GridColumn();
$first  = new \Kendo\UI\GridColumnCommandItem();
$second = new \Kendo\UI\GridColumnCommandItem();
$column->addCommandItem($first, $second);
?>

dataSource

Sets the data source of the widget.

Returns

\Kendo\UI\GridColumn

Parameters

$value \Kendo\Data\DataSource|array

Example - using \Kendo\Data\DataSource

<?php
$column = new \Kendo\UI\GridColumn();
$dataSource = new \Kendo\Data\DataSource();
$column->dataSource($dataSource);
?>

Example - using array

<?php
$column = new \Kendo\UI\GridColumn();
$schema = new \Kendo\Data\DataSourceSchema();
$column->dataSource(array('schema' => $schema));
?>

dataTextField

The data text field of the foreign key item.

Returns

\Kendo\UI\GridColumn

Parameters

$value string

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->dataTextField('value');
?>

dataValueField

The data value field of the foreign key item.

Returns

\Kendo\UI\GridColumn

Parameters

$value string

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->dataValueField('value');
?>

draggable

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

Returns

\Kendo\UI\GridColumn

Parameters

$value boolean

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->draggable(true);
?>

editable

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

Returns

\Kendo\UI\GridColumn

Parameters

$value \Kendo\JavaScriptFunction

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->editable(new \Kendo\JavaScriptFunction('function() { }'));
?>

editor

Provides a way to specify a custom editing UI for the column. Use the container parameter to create the editing UI.When used as String, defines the editor widget type. For further info check the Form API: field

Returns

\Kendo\UI\GridColumn

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string

<?php
$column = new \Kendo\UI\GridColumn();
$column->editor('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$column = new \Kendo\UI\GridColumn();
$column->editor(new \Kendo\JavaScriptFunction('function() { }'));
?>

editorOptions

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

Returns

\Kendo\UI\GridColumn

Parameters

$value ``

encoded

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

Returns

\Kendo\UI\GridColumn

Parameters

$value boolean

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->encoded(true);
?>

exportable

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.

Returns

\Kendo\UI\GridColumn

Parameters

$value boolean|\Kendo\UI\GridColumnExportable|array

Example - using boolean

<?php
$column = new \Kendo\UI\GridColumn();
$column->exportable(true);
?>

Example - using \Kendo\UI\GridColumnExportable

<?php
$column = new \Kendo\UI\GridColumn();
$exportable = new \Kendo\UI\GridColumnExportable();
$excel = true;
$exportable->excel($excel);
$column->exportable($exportable);
?>

Example - using array

<?php
$column = new \Kendo\UI\GridColumn();
$excel = true;
$column->exportable(array('excel' => $excel));
?>

field

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

Returns

\Kendo\UI\GridColumn

Parameters

$value string

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->field('value');
?>

filterable

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

Returns

\Kendo\UI\GridColumn

Parameters

$value boolean|\Kendo\UI\GridColumnFilterable|array

Example - using boolean

<?php
$column = new \Kendo\UI\GridColumn();
$column->filterable(true);
?>

Example - using \Kendo\UI\GridColumnFilterable

<?php
$column = new \Kendo\UI\GridColumn();
$filterable = new \Kendo\UI\GridColumnFilterable();
$checkAll = true;
$filterable->checkAll($checkAll);
$column->filterable($filterable);
?>

Example - using array

<?php
$column = new \Kendo\UI\GridColumn();
$checkAll = true;
$column->filterable(array('checkAll' => $checkAll));
?>

footerAttributes

HTML attributes of the column footer. The footerAttributes option can be used to set the HTML attributes of that cell.

Returns

\Kendo\UI\GridColumn

Parameters

$value ``

footerTemplate

The 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) or data - provides access to all available aggregates, e.g. data.fieldName1.sum or data.fieldName2.average.

Returns

\Kendo\UI\GridColumn

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string

<?php
$column = new \Kendo\UI\GridColumn();
$column->footerTemplate('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$column = new \Kendo\UI\GridColumn();
$column->footerTemplate(new \Kendo\JavaScriptFunction('function() { }'));
?>

format

The format that is applied to the value before it is displayed.Takes the form "{0:format}" where "format" can be a: default number format; custom number format; default date format or custom date format.

Returns

\Kendo\UI\GridColumn

Parameters

$value string

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->format('value');
?>

groupFooterTemplate

The 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.sum or data.fieldName2.average or group - provides information for the current group. An object with three fields - field, value and items. items field contains the data items for current group. Returns groups if the data items are grouped (in case there are child groups).

Returns

\Kendo\UI\GridColumn

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string

<?php
$column = new \Kendo\UI\GridColumn();
$column->groupFooterTemplate('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$column = new \Kendo\UI\GridColumn();
$column->groupFooterTemplate(new \Kendo\JavaScriptFunction('function() { }'));
?>

groupHeaderColumnTemplate

Introduced 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.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.sum or data.fieldName2.average or group - provides information for the current group. An object with three fields - field, value and items. items field contains the data items for current group. Returns groups if the data items are grouped (in case there are child groups).

Returns

\Kendo\UI\GridColumn

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string

<?php
$column = new \Kendo\UI\GridColumn();
$column->groupHeaderColumnTemplate('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$column = new \Kendo\UI\GridColumn();
$column->groupHeaderColumnTemplate(new \Kendo\JavaScriptFunction('function() { }'));
?>

groupHeaderTemplate

The 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.sum or aggregates.fieldName2.average or items - the data items for current group. Returns groups if the data items are grouped (in case there are child groups).

Returns

\Kendo\UI\GridColumn

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string

<?php
$column = new \Kendo\UI\GridColumn();
$column->groupHeaderTemplate('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$column = new \Kendo\UI\GridColumn();
$column->groupHeaderTemplate(new \Kendo\JavaScriptFunction('function() { }'));
?>

groupable

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

Returns

\Kendo\UI\GridColumn

Parameters

$value boolean|\Kendo\UI\GridColumnGroupable|array

Example - using boolean

<?php
$column = new \Kendo\UI\GridColumn();
$column->groupable(true);
?>

Example - using \Kendo\UI\GridColumnGroupable

<?php
$column = new \Kendo\UI\GridColumn();
$groupable = new \Kendo\UI\GridColumnGroupable();
$sort = new \Kendo\UI\GridColumnGroupableSort();
$groupable->sort($sort);
$column->groupable($groupable);
?>

Example - using array

<?php
$column = new \Kendo\UI\GridColumn();
$sort = new \Kendo\UI\GridColumnGroupableSort();
$column->groupable(array('sort' => $sort));
?>

headerAttributes

HTML attributes of the column header. The grid renders a table header cell (

) for every column. The headerAttributes option can be used to set the HTML attributes of that th.

Returns

\Kendo\UI\GridColumn

Parameters

$value ``

headerTemplate

The template which renders the column header content. By default the value of the title column option is displayed in the column header cell.

Returns

\Kendo\UI\GridColumn

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string

<?php
$column = new \Kendo\UI\GridColumn();
$column->headerTemplate('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$column = new \Kendo\UI\GridColumn();
$column->headerTemplate(new \Kendo\JavaScriptFunction('function() { }'));
?>

hidden

If set to true the column will not be displayed in the grid. By default all columns are displayed.

Returns

\Kendo\UI\GridColumn

Parameters

$value boolean

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->hidden(true);
?>

hideOnGroup

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

Returns

\Kendo\UI\GridColumn

Parameters

$value boolean

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->hideOnGroup(true);
?>

lockable

If set to false the column will remain in the side of the grid into which its own locked configuration placed it.

Returns

\Kendo\UI\GridColumn

Parameters

$value boolean

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->lockable(true);
?>

locked

If set to true the column will be displayed as locked (frozen) in the grid. Also see Locked Columns help section for additional information.

Returns

\Kendo\UI\GridColumn

Parameters

$value boolean

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->locked(true);
?>

media

Sets 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: xs is equivalent to "(max-width: 576px)"; sm is equivalent to "(min-width: 576px)"; md is equivalent to "(min-width: 768px)"; lg is equivalent to "(min-width: 992px)" or xl is equivalent to "(min-width: 1200px)".

Returns

\Kendo\UI\GridColumn

Parameters

$value string

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->media('value');
?>

If 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).

Returns

\Kendo\UI\GridColumn

Parameters

$value boolean

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->menu(true);
?>

minResizableWidth

The pixel screen width below which the user will not be able to resize the column via the UI.

Returns

\Kendo\UI\GridColumn

Parameters

$value float

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->minResizableWidth(1);
?>

minScreenWidth

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

Returns

\Kendo\UI\GridColumn

Parameters

$value float

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->minScreenWidth(1);
?>

selectable

If 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.More about the Grid Selection feature you can find in this documentation article.

Returns

\Kendo\UI\GridColumn

Parameters

$value boolean

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->selectable(true);
?>

sortable

If set to true the user can click the column header and sort the grid by the column field when sorting is enabled. If set to false sorting will be disabled for this column. By default all columns are sortable if sorting is enabled via the sortable option.

Returns

\Kendo\UI\GridColumn

Parameters

$value boolean|\Kendo\UI\GridColumnSortable|array

Example - using boolean

<?php
$column = new \Kendo\UI\GridColumn();
$column->sortable(true);
?>

Example - using \Kendo\UI\GridColumnSortable

<?php
$column = new \Kendo\UI\GridColumn();
$sortable = new \Kendo\UI\GridColumnSortable();
$allowUnsort = true;
$sortable->allowUnsort($allowUnsort);
$column->sortable($sortable);
?>

Example - using array

<?php
$column = new \Kendo\UI\GridColumn();
$allowUnsort = true;
$column->sortable(array('allowUnsort' => $allowUnsort));
?>

stickable

If set to true the user will be able to stick or unstick the column from the column menu.

Returns

\Kendo\UI\GridColumn

Parameters

$value boolean

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->stickable(true);
?>

sticky

If set to true the column will be displayed as sticky in the grid. Also see Sticky Columns help section for additional information.

Returns

\Kendo\UI\GridColumn

Parameters

$value boolean

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->sticky(true);
?>

template

The template which renders the column content. The grid renders table rows (

) which represent the data source items. Each table row consists of table cells () which represent the grid columns. By default the HTML-encoded value of the field is displayed in the column.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 or Column Template | Kendo UI Grid.

Returns

\Kendo\UI\GridColumn

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string

<?php
$column = new \Kendo\UI\GridColumn();
$column->template('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$column = new \Kendo\UI\GridColumn();
$column->template(new \Kendo\JavaScriptFunction('function() { }'));
?>

title

The text that is displayed in the column header cell. If not set the field is used.

Returns

\Kendo\UI\GridColumn

Parameters

$value string

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->title('value');
?>

values

An array of values that will be displayed instead of the bound value. Each item in the array must have a text and value fields.

Returns

\Kendo\UI\GridColumn

Parameters

$value array

Example

<?php
$column = new \Kendo\UI\GridColumn();
$column->values(array());
?>

width

The width of the column. Numeric values are treated as pixels. The width option supports the fundamental measuring units. For instance: px sets the width in pixels; cm sets the width in centimeters; mm sets the width in millimeters; % sets the width relative to the grid's element width; em sets the width relative to the font-size of the grid's element width or rem sets 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.

Returns

\Kendo\UI\GridColumn

Parameters

$value string|float

Example - using string

<?php
$column = new \Kendo\UI\GridColumn();
$column->width('value');
?>

Example - using float

<?php
$column = new \Kendo\UI\GridColumn();
$column->width(1);
?>
In this article
Not finding the help you need?