New to Kendo UI for Angular? Start a free 30-day trial

ColumnComponent

Represents the columns of the Angular TreeList.

Example
View Source
Edit In Stackblitz  
Change Theme:

Selector

kendo-treelist-column

Inputs

autoSize

boolean

Indicates whether the column will be resized during initialization so that it fits its header and row content.

columnMenu

boolean

Specifies if the column menu will be shown for the column.

class

string | string[] | Set<string> | {[key: string]: any}

Sets the custom CSS classes to the column cells. Under the hood, to apply the property, the class option uses the NgClass directive. To customize header and footer column cells, use the headerClass and footerClass inputs.

import { Component, ViewEncapsulation } from '@angular/core';

@Component({
   selector: 'my-app',
   encapsulation: ViewEncapsulation.None,
   styles: [`
       tr .myClass {
           text-align: right
      }
   `],
   template: `
       <kendo-treelist [data]="treelistData" style="height: 200px">
         <kendo-treelist-column field="ProductName" title="Product Name" width="200" [class]="{'myClass': true}">
         </kendo-treelist-column>
         <kendo-treelist-column field="UnitPrice" title="Unit Price" width="230">
         </kendo-treelist-column>
       </kendo-treelist>
   `
})

class AppComponent {
   public treelistData: any[];

   constructor() {
       this.treelistData = [{
           "ProductID": 1,
           "ProductName": "Chai",
           "UnitPrice": 18.0000,
           "Discontinued": true
         }, {
           "ProductID": 2,
           "ProductName": "Chang",
           "UnitPrice": 19.0000,
           "Discontinued": false
         }];
   }
}

editable

boolean

Defines whether the column is editable. The default value is true.

<kendo-treelist>
   <kendo-treelist-column field="UnitPrice" [editable]="false">
   </kendo-treelist-column>
</kendo-treelist>

editor

"text" | "numeric" | "date" | "boolean"

Defines the editor type (see example). Used when the column enters the edit mode. The default value is text.

<kendo-treelist>
   <kendo-treelist-column field="UnitPrice" editor="numeric">
   </kendo-treelist-column>
</kendo-treelist>

expandable

boolean

(default: false) Defines whether the expanded indicator should be rendered in the column.

field

string

The field to which the column is bound.

filter

"text" | "numeric" | "boolean" | "date"

Defines the filter type that is displayed inside the filter row. The default value is text.

<kendo-treelist>
   <kendo-treelist-column field="UnitPrice" filter="numeric">
   </kendo-treelist-column>
</kendo-treelist>

filterable

boolean

Defines if a filter UI will be displayed for this column. The default value is true.

<kendo-treelist>
   <kendo-treelist-column field="UnitPrice" [filterable]="false">
   </kendo-treelist-column>
</kendo-treelist>

footerClass

string | string[] | Set<string> | {[key: string]: any}

Sets the custom CSS classes to the column footer cell. Under the hood, to apply the property, the footerClass option uses the NgClass directive.

import { Component, ViewEncapsulation } from '@angular/core';

@Component({
   selector: 'my-app',
   encapsulation: ViewEncapsulation.None,
   styles: [`
       tr .myClass {
           text-align: right
      }
   `],
   template: `
       <kendo-treelist [data]="treelistData" style="height: 200px">
         <kendo-treelist-column field="ProductName" title="Product Name" width="200" [footerClass]="{'myClass': true}">
             <ng-template kendoTreeListFooterTemplate>
                 footer text
             </ng-template>
         </kendo-treelist-column>
         <kendo-treelist-column field="UnitPrice" title="Unit Price" width="230">
         </kendo-treelist-column>
       </kendo-treelist>
   `
})

class AppComponent {
   public treelistData: any[];

   constructor() {
       this.treelistData = [{
           "ProductID": 1,
           "ProductName": "Chai",
           "UnitPrice": 18.0000,
           "Discontinued": true
         }, {
           "ProductID": 2,
           "ProductName": "Chang",
           "UnitPrice": 19.0000,
           "Discontinued": false
         }];
   }
}

footerStyle

{[key: string]: string}

Sets the custom styles for the footer cell of the column. Under the hood, to apply the property, the footerStyle option uses the NgStyle directive.

@Component({
   selector: 'my-app',
   template: `
       <kendo-treelist [data]="treelistData" style="height: 200px">
         <kendo-treelist-column field="ProductName" title="Product Name" width="200" [footerStyle]="{'text-align': 'right'}">
             <ng-template kendoTreeListFooterTemplate>
                 footer text
             </ng-template>
         </kendo-treelist-column>
         <kendo-treelist-column field="UnitPrice" title="Unit Price" width="230">
         </kendo-treelist-column>
       </kendo-treelist>
   `
})

class AppComponent {
   public treelistData: any[];

   constructor() {
       this.treelistData = [{
           "ProductID": 1,
           "ProductName": "Chai",
           "UnitPrice": 18.0000,
           "Discontinued": true
         }, {
           "ProductID": 2,
           "ProductName": "Chang",
           "UnitPrice": 19.0000,
           "Discontinued": false
         }];
   }
}

format

any

The format that is applied to the value before it is displayed. Takes the {0:format} form where format is a standard number format, a custom number format, a standard date format, a custom date format or a format object. For more information on the supported date and number formats, refer to the kendo-intl documentation.

Standard format:

<kendo-treelist>
   <kendo-treelist-column field="UnitPrice" format="{0:c}">
   </kendo-treelist-column>
</kendo-treelist>

Format object for currency:

<kendo-treelist>
   <kendo-treelist-column field="UnitPrice" [format]="{ style: 'currency', currency: 'EUR' }">
   </kendo-treelist-column>
</kendo-treelist>

Format object for dates:

<kendo-treelist>
   <kendo-treelist-column field="FirstOrderedOn" [format]="{ date: 'short' }">
   </kendo-treelist-column>
</kendo-treelist>

headerClass

string | string[] | Set<string> | {[key: string]: any}

Sets the custom CSS classes to the column header cell. Under the hood, to apply the property, the headerClass option uses the NgClass directive.

import { Component, ViewEncapsulation } from '@angular/core';

@Component({
   selector: 'my-app',
   encapsulation: ViewEncapsulation.None,
   styles: [`
       tr .myClass {
           text-align: right
      }
   `],
   template: `
       <kendo-treelist [data]="treelistData" style="height: 200px">
         <kendo-treelist-column field="ProductName" title="Product Name" width="200" [headerClass]="{'myClass': true}">
         </kendo-treelist-column>
         <kendo-treelist-column field="UnitPrice" title="Unit Price" width="230">
         </kendo-treelist-column>
       </kendo-treelist>
   `
})

class AppComponent {
   public treelistData: any[];

   constructor() {
       this.treelistData = [{
           "ProductID": 1,
           "ProductName": "Chai",
           "UnitPrice": 18.0000,
           "Discontinued": true
         }, {
           "ProductID": 2,
           "ProductName": "Chang",
           "UnitPrice": 19.0000,
           "Discontinued": false
         }];
   }
}

headerStyle

{[key: string]: string}

Sets the custom styles for the header cell of the column. Under the hood, to apply the property, the headerStyle option uses the NgStyle directive.

@Component({
   selector: 'my-app',
   template: `
       <kendo-treelist [data]="treelistData" style="height: 200px">
         <kendo-treelist-column field="ProductName" title="Product Name" width="200" [headerStyle]="{'text-align': 'right'}">
         </kendo-treelist-column>
         <kendo-treelist-column field="UnitPrice" title="Unit Price" width="230">
         </kendo-treelist-column>
       </kendo-treelist>
   `
})

class AppComponent {
   public treelistData: any[];

   constructor() {
       this.treelistData = [{
           "ProductID": 1,
           "ProductName": "Chai",
           "UnitPrice": 18.0000,
           "Discontinued": true
         }, {
           "ProductID": 2,
           "ProductName": "Chang",
           "UnitPrice": 19.0000,
           "Discontinued": false
         }];
   }
}

hidden

boolean

(default: false) Sets the visibility of the column (see example).

includeInChooser

boolean

Specifies if the column will be included in the column-chooser list.

lockable

boolean

Specifies if the column can be locked or unlocked from the column menu or by reordering the columns.

locked

boolean

(default: false) Toggles the locked (frozen) state of the columns (more information and example).

@Component({
   selector: 'my-app',
   template: `
       <kendo-treelist [data]="treelistData" [scrollable]="scrollable" style="height: 200px">
         <kendo-treelist-column field="ProductID" title="Product ID" width="120" [locked]="true">
         </kendo-treelist-column>
         <kendo-treelist-column field="ProductName" title="Product Name" width="200">
         </kendo-treelist-column>
         <kendo-treelist-column field="UnitPrice" title="Unit Price" width="230">
         </kendo-treelist-column>
       </kendo-treelist>
   `
})

class AppComponent {
   public treelistData: any[];

   constructor() {
       this.treelistData = products;
   }
}

const products = [{
   "ProductID": 1,
   "ProductName": "Chai",
   "UnitPrice": 18.0000,
   "Discontinued": true
 }, {
   "ProductID": 2,
   "ProductName": "Chang",
   "UnitPrice": 19.0000,
   "Discontinued": false
 }
];

media

string

Sets the condition that needs to be satisfied for a column to remain visible (see example). If you set the hidden property, the behavior of media is overridden.

<kendo-treelist>
   <kendo-treelist-column field="UnitPrice" media="(min-width: 320px)">
   </kendo-treelist-column>
</kendo-treelist>

Accepts the device identifiers that are available in Bootstrap 4 (see example):

  • "xs"Equivalent to "(max-width: 576px)".
  • "sm"Equivalent to "(min-width: 576px)".
  • "md"Equivalent to "(min-width: 768px)".
  • "lg"Equivalent to "(min-width: 992px)".
  • "xl"Equivalent to "(min-width: 1200px)".
<kendo-treelist>
   <kendo-treelist-column field="UnitPrice" media="md">
   </kendo-treelist-column>
</kendo-treelist>

minResizableWidth

number

The width (in pixels) below which the user is not able to resize the column by using the UI.

reorderable

boolean

(default: true) Indicates whether the column is reorderable.

resizable

boolean

(default: true) Indicates whether the column is resizable.

sortable

boolean | ColumnSortSettings

Allows the column headers to be clicked and the sortChange event emitted. You have to handle the sortChange event yourself and sort the data.

style

{[key: string]: string}

Sets the custom styles for the table cells (excluding the footer and header ones) of the column. Under the hood, to apply the property, the style option uses the NgStyle directive.

@Component({
   selector: 'my-app',
   template: `
       <kendo-treelist [data]="treelistData" style="height: 200px">
         <kendo-treelist-column field="ProductName" title="Product Name" width="200" [style]="{'text-align': 'right'}">
         </kendo-treelist-column>
         <kendo-treelist-column field="UnitPrice" title="Unit Price" width="230">
         </kendo-treelist-column>
       </kendo-treelist>
   `
})

class AppComponent {
   public treelistData: any[];

   constructor() {
       this.treelistData = [{
           "ProductID": 1,
           "ProductName": "Chai",
           "UnitPrice": 18.0000,
           "Discontinued": true
         }, {
           "ProductID": 2,
           "ProductName": "Chang",
           "UnitPrice": 19.0000,
           "Discontinued": false
         }];
   }
}

title

string

The title of the column.

width

number

The width of the column (in pixels).

Fields

orderIndex

number

The column index after reordering.

orderIndex is a read-only property. Setting this field does not affect column order.