All Components

Data Binding Basics

The main purpose of the Grid is to display your model data.

The appropriate type of data binding depends on your scenario and the features you need. The Grid can be bound to Array or GridDataResult objects by setting the data property of the <kendo-grid> tag.

When you bind the Grid to data, note the following specifics:

  1. When paging is disabled, you have to bind the data directly as an Array object.
  2. When paging or virtual scrolling is enabled, you need to use the GridDataResult option—it enables you to set the total number of records in a different data length from the currently provided one.
  3. When the data is received from an asynchronous source, you have to pipe it through the async pipe.
import { Component, ViewChild, Input, OnInit, Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Observable, BehaviorSubject } from 'rxjs/Rx';

import {
} from '@progress/kendo-angular-grid';

import {
} from '@progress/kendo-data-query';

/* Example service */
export class CategoriesService extends BehaviorSubject<GridDataResult> {
    private BASE_URL: string = '';
    private tableName: string = "Categories";

    constructor(private http: Http) {

    public query(state): void {
        this.fetch(this.tableName, state)
            .subscribe(x =>;

    private fetch(tableName: string, state: any): Observable<GridDataResult> {
        const queryStr = `${toODataString(state)}&$count=true`;
        return this.http
            .map(response => response.json())
            .map(response => (<GridDataResult>{
                data: response.value,
                total: parseInt(response["@odata.count"], 10)
  providers: [CategoriesService],
  selector: 'my-app',
  template: `
          [data]="view | async"
        <kendo-grid-column field="CategoryID" width="100"></kendo-grid-column>
        <kendo-grid-column field="CategoryName" width="200"></kendo-grid-column>
        <kendo-grid-column field="Description" [sortable]="false">

class AppComponent {
    private view: Observable<GridDataResult>;
    private pageSize: number = 5;
    private skip: number  = 0;

    @ViewChild(GridComponent) private grid: GridComponent;
    constructor(private service: CategoriesService) {
        this.view = service;

        this.service.query({ skip: this.skip, take: this.pageSize });

    public ngAfterViewInit(): void {
            .do(({ skip, take }: DataStateChangeEvent) => {
                this.skip = skip;
                this.pageSize = take;
            .subscribe(x => this.service.query(x));
In this article