@Component({
selector: 'app-root',
template: `<ejs-grid #grid [dataSource]='data' [allowGrouping]='true' [groupSettings]='groupOptions'
height='315px'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' textAlign='Right' width=120></e-column>
. . . .
</ejs-grid>
<ng-template #tt let-data>
<div>
<span class='groupHeader' style='color:blue'>{{data.CustomerID}}</span>
<span class='groupItems' style='color:blue'>({{data.count}} items)</span>
</div>
</ng-template>`
})
export class AppComponent implements OnInit {
public data: Object[];
public groupOptions: GroupSettingsModel;
@ViewChild('grid')
private grid: GridComponent;
@ViewChild('tt')
public template: any;
ngOnInit(): void {
this.data = data;
this.groupOptions = { captionTemplate: this.template, columns: ['CustomerID'] };
}
} |
@Component({
selector: 'app-root',
template: `<ejs-grid #grid [dataSource]='data' [allowGrouping]='true' [groupSettings]='groupOptions'
height='315px'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' textAlign='Right' width=120></e-column>
. . . . .
</ejs-grid>
<ng-template #tt let-data>
<div *ngIf="data.field=="CustomerID"; else elseblock">
<div>
<span class='groupHeader' style='color:blue'>{{data.CustomerID}}</span>
<span class='groupItems' style='color:blue'>({{data.count}} items)</span>
</div>
</ng-template>
<ng-template #elseblock>
<div>
<span class='groupHeader' style='color:blue'>{{data.OrderDate}}</span>
<span class='groupItems' style='color:blue'>({{data.count}} items)</span>
</div>
</ng-template>`
})
export class AppComponent implements OnInit {
public data: Object[];
public groupOptions: GroupSettingsModel;
@ViewChild('grid')
private grid: GridComponent;
@ViewChild('tt')
public template: any;
ngOnInit(): void {
this.data = data;
this.groupOptions = { captionTemplate: this.template, columns: ['CustomerID'] };
}
} |
@Component({
selector: 'app-root',
template: `<ejs-grid #grid [dataSource]='data' [allowGrouping]='true' [groupSettings]='groupOptions'
height='315px' (actionFailure)='actionFailure($event)'>
<e-columns>
.... . . . .
</e-columns>
<ng-template #groupSettingsCaptionTemplate let-data>
<span class='groupHeader' style='color:blue'>{{data.field}}</span>
<span class='groupItems' style='color:blue'>newcount{{data.count}} items</span>
</ng-template>
</ejs-grid>`
})
export class AppComponent implements OnInit { }
|
this.groupOptions = {
captionTemplate: '<span style="color:lightblue">${field} - ${key}</span>',
showGroupedColumn: false, columns: ['Country']
};
|