|
@Component({
selector: 'my-app',
template: `
<ejs-grid #grid [dataSource]='rows' (queryCellInfo)='info($event)'>
<e-columns>
<e-column headerText="Details">
<ng-template #template let-data>
{{ data.RowDetails }}
</ng-template>
</e-column>
<e-column field='DisplayValue' headerText="Display Value" [valueAccessor]='valueAccess'>
</e-column> </e-columns>
</ejs-grid> `
})
export class App {
rows: MyDisplayObject[];
constructor() {
this.rows = [];
const row1 = new MyDisplayObject();
row1.OrderID = 1123;
row1.RowDetails = 'My details row';
this.rows.push(row1);
}
public valueAccess = (field: string, data: Object, column: Object) => {
return data['RowDetails'] + ' And More Details for Display';
}
} |
|
@Component({
selector: 'my-app',
template: `
<ejs-grid #grid [dataSource]='rows' >
<e-columns>
<e-column headerText="Display Value">
<ng-template #template let-data>
{{ data.DisplayValue }}
</ng-template>
</e-column>
</e-columns>
</ejs-grid> `
})
export class App {
. . .
}
export class MyDisplayObject
. . .
constructor() {
Object.defineProperty(this, 'DisplayValue', {
enumerable: true, { // setting Enumerable
get: function () { return this.RowDetails + ' And More Details for Display'; }
});
}
} |