SpanColumnComponent

Represents a column which can be spanned over multiple data cells while the individual
header and footer cells are retained (see example).
Enables you to achieve more flexible layout while keeping the built-in UI element for
sorting, filtering, and
grouping. Wrap the columns that will be
merged inside the <kendo-grid-span-column> tag.

@Component({
   selector: 'my-app',
   template: `
       <kendo-grid
             [sortable]="true"
             [filterable]="true"
             [kendoGridBinding]="products">
         <kendo-grid-column field="ProductID" title="Product ID" width="120">
         </kendo-grid-column>
         <kendo-grid-span-column>
             <kendo-grid-column field="ProductName" title="Product Name">
             </kendo-grid-column>
             <kendo-grid-column field="UnitPrice" title="Unit Price" filter="numeric" width="180" format="{0:c}">
             </kendo-grid-column>
         </kendo-grid-span-column>
         <kendo-grid-column field="Discontinued" width="120" filter="boolean">
             <ng-template kendoGridCellTemplate let-dataItem>
                 <input type="checkbox" [checked]="dataItem.Discontinued" disabled/>
             </ng-template>
         </kendo-grid-column>
       </kendo-grid>
   `
})

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

By default, the data cell displays the data for the specified fields. To further customize
the span-column functionality, use a cell template.

<kendo-grid-span-column>
 <kendo-grid-column field="field1" title="Field 1"></kendo-grid-column>
 <kendo-grid-column field="field2" title="Field 2"></kendo-grid-column>
   <ng-template kendoGridCellTemplate let-dataItem>
       <h5>{{ dataItem.field1 }}</h5>
       <p>{{ dataItem.field2 }}</p>
   </ng-template>
 </kendo-grid-span-column>

Selector

kendo-grid-span-column

Inputs

columnMenu boolean

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

class string | string[] | Set | {[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-grid [data]="gridData" style="height: 200px">
         <kendo-grid-column field="ProductName" title="Product Name" width="200" [class]="{'myClass': true}">
         </kendo-grid-column>
         <kendo-grid-column field="UnitPrice" title="Unit Price" width="230">
         </kendo-grid-column>
       </kendo-grid>
   `
})

class AppComponent {
   public gridData: any[];

   constructor() {
       this.gridData = [{
           "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).

lockable boolean

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

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-grid>
   <kendo-grid-column field="UnitPrice" [media]="'(min-width: 320px)'">
   </kendo-grid-column>
</kendo-grid>

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-grid>
   <kendo-grid-column field="UnitPrice" [media]="'md'">
   </kendo-grid-column>
</kendo-grid>

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.

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-grid [data]="gridData" style="height: 200px">
         <kendo-grid-column field="ProductName" title="Product Name" width="200" [style]="{'text-align': 'right'}">
         </kendo-grid-column>
         <kendo-grid-column field="UnitPrice" title="Unit Price" width="230">
         </kendo-grid-column>
       </kendo-grid>
   `
})

class AppComponent {
   public gridData: any[];

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

editable boolean

Defines whether the edit template of the column will be rendered. The default value is false.

To enable the editing functionality for a spanned column, set an edit template for it.

<kendo-grid>
   <kendo-grid-span-column [editable]="false">
     <kendo-grid-column field="UnitPrice">
     </kendo-grid-column>
     <kendo-grid-column field="ProductName">
     </kendo-grid-column>
     <ng-template kendoGridEditTemplate>
        .....
     </ng-template>
   </kendo-grid-span-column>
</kendo-grid>

locked boolean (default: false)

Toggles the locked (frozen) state of the columns. Locked columns are visible
at all times during the horizontal scrolling of the Grid.

For the option to work properly, make sure that:

  • Scrolling is enabled.
  • The height option of the Grid is set.
  • The widths of all Grid columns are explicitly set in pixels. In this way, the Grid adjusts the layout of the locked and unlocked columns.
@Component({
   selector: 'my-app',
   template: `
       <kendo-grid [data]="gridData" [scrollable]="scrollable" style="height: 200px">
         <kendo-grid-span-column [locked]="true">
            <kendo-grid-column field="ProductID" title="Product ID" width="120">
            </kendo-grid-column>
            <kendo-grid-column field="ProductName" title="Product Name" width="200">
            </kendo-grid-column>
         </kendo-grid-span-column>
         <kendo-grid-column field="UnitPrice" title="Unit Price" width="230">
         </kendo-grid-column>
       </kendo-grid>
   `
})

class AppComponent {
   public gridData: any[];

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

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

Fields

orderIndex number

The column index after reordering.

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