UI-Grid

noRecords

// a customzied message for noRecords
$("#grid").kendoGrid({
  columns: [
    ...
  ],
  dataSource: {
    ...
  },
  noRecords: true,
  messages: {
    noRecords: "There is no data on current page"
  }
});
// The template which is rendered when current view contains no records
$("#grid").kendoGrid({
  columns: [
    ...
  ],
  dataSource: {
    ...
  },
  noRecords:{
     template: "No data available on current page. Current page is: #=this.dataSource.page()#"
  }
});

Auto Sizing

dataBound : function () {
    var grid = $(".life-alpha-index").data("kendoGrid");
    for (var i = 0; i < grid.columns.length; i++) {
         grid.autoFitColumn(i);
    }  
}

Customized FooterTemplate

var gridDataSource = new kendo.data.DataSource({...});

window.calculatePriceAggregate = function () {
    var data = gridDataSource.data();
    var total = 0;
    for(var i = 0; i < data.length; i++) {
        if (data[i].EligibleForDiscount === true) {
            total += data[i].Price;
        }
    }
    return total;
};

$("#grid").kendoGrid({
    data: gridDataSource,
    ...
    columns: [
        {
            field: 'Price',
            footerTemplate: '#=window.calculatePriceAggregate()#'
        }

    ]
});

// example to format value of footerTemplate 
{    field: "Price",
               title: "Price",
               footerTemplate: "Total Price: #= kendo.toString(sum, 'C') #"
}

results matching ""

    No results matching ""