App.component.ts
enable() { // Button click function
this.grid.updateRow(0, {
OrderID: 10248,
CustomerID: "VI",
Freight: 13
});
}
disable(){ // Button click function
var oldID = this.grid.dataSource[1].OrderID;
var data = this.grid.dataSource[2];
this.grid.setRowData(oldID, data);
}
rowDataBound(args: RowDataBoundEventArgs) {
console.log("RowdataBound hitted.....")
}
queryCellInfo(args: any){
console.log("QueryCellInfo hitted.....")
if(args.data.Freight < "25" ){
args.cell.bgColor = "Grey"; // This will change the color according to datas in Grid.
}
}
} |
App.component.ts
import { Component, OnInit, ViewChild } from '@angular/core';
disable(){
var mmm = {OrderID: 111, CustomerID: "bbb", Freight: 12}
this.grid.setRowData(10250, mmm);
}
rowDataBound(args: RowDataBoundEventArgs) {
console.log("RowdataBound hitted.....", args);
if (args.data['CustomerID'] === 'bbb'){
console.log('CustomerID == bbb');
var cell = args.row.cells;
for(var i=0; i<cell.length; i++){
cell[i].style.backgroundColor = "Pink";
}
}
} |
App.component.ts
enable() {
this.grid.updateRow(3, {
OrderID: 10251,
CustomerID: "aaa",
Freight: 13
}); |