Empty

by valchev

HTML

<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.2.710/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.2.710/styles/kendo.default.min.css">
<script src="http://cdn.kendostatic.com/2012.2.710/js/kendo.all.min.js"></script>
<div id="grid"></div>

JavaScript

$("#grid").kendoGrid({
    dataSource: {
        type: "odata",
        transport: {
            read: "http://demos.kendoui.com/service/Northwind.svc/Products"
        },
        schema: {
            model: {
                fields: {
                    ProductName: {type: "string"},
                    UnitPrice: {type: "number"},
                    UnitsInStock: {type: "number"},
                    UnitsOnOrder: {type: "number"}
                }
            }                
        },
        pageSize: 50,
        group: {
            field: "UnitsInStock",
            aggregates: [
                {
                field: "ProductName",
                aggregate: "count"},
            {
                field: "UnitPrice",
                aggregate: "sum"},
            {
                field: "UnitsOnOrder",
                aggregate: "average"},
            {
                field: "UnitsInStock",
                aggregate: "count"}
            ]
        },

        aggregate: [{
            field: "ProductName",
            aggregate: "count"},
        {
            field: "UnitPrice",
            aggregate: "sum"},
        {
            field: "UnitsOnOrder",
            aggregate: "average"},
        {
            field: "UnitsInStock",
            aggregate: "min"},
        {
            field: "UnitsInStock",
            aggregate: "max"}]
    },
    sortable: true,
    scrollable: true,
    height: 500,
    groupable: true,
    pageable: true,
    filterable: true,
    dataBound: function(e) {

        if(this.dataSource.view().length == 0) {
             var colspan = this.content.find("table col").length;
             this.content.find("table").append("<tr><td colspan=" + colspan + "></td></tr>");
        }
        
        //set the initial scroll
        $("#grid").find(".k-grid-footer-wrap")
            .scrollLeft($("#grid").find(".k-grid-content").scrollLeft());
        
        this.content.bind('scroll', function () {
           ...