\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 ``

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);
?>

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.

Returns

\Kendo\UI\GridColumn

Parameters

$value \Kendo\JavaScriptFunction

Example

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

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);
?>

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 no spaces, no special characters, and the first character should be a letter.

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" is a standard number format,custom number format, standard date format or a 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 when the grid is grouped by the column field. By default the group footer is not displayed.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() { }'));
?>

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 column will not be groupable (requires Grid groupable property to be enabled). By default all columns are groupable.

Returns

\Kendo\UI\GridColumn

Parameters

$value boolean

Example

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

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);
?>

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 the information about Locked Columns in the Grid Appearance article.

Returns

\Kendo\UI\GridColumn

Parameters

$value boolean

Example

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

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.

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();
$initialDirection = 'value';
$sortable->initialDirection($initialDirection);
$column->sortable($sortable);
?>

Example - using array

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

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.

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. For more important information, please refer to Column Widths.

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);
?>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy