|
Html:
<input type="button" id="show" (click)="show()" value="Show" />
<input type="button" id="hide" (click)="hide()" value="Hide" />
<ejs-grid #grid [allowGrouping]="true" [groupSettings]="groupOptions">
...
</ejs-grid>
----------------------------------------------------------------------------------------------------------------------------------------
Typescript:
export class GroupComponent implements OnInit {
@ViewChild('grid')
public grid: GridComponent;
ngOnInit(): void {
this.groupOptions = { showDropArea: false }; // to hide the drop area at initial rendering
}
hide(){
(this.grid.groupModule as any).groupSettings.showDropArea = false;
this.grid.refresh();
}
show(){
(this.grid.groupModule as any).groupSettings.showDropArea = true;
this.grid.refresh();
}
} |
|
[app.component.html]
<ejs-grid #grid [dataSource]='data' (actionComplete)= 'actionComplete($event)' allowPaging='true' allowSorting="true" [allowGrouping]="true" [groupSettings]="groupOptions">
. . .
</e-columns>
</ejs-grid>
[app.component.ts]
. . .
actionComplete(args) {
if (args.requestType === 'grouping' || args.requestType === 'ungrouping') {
this.grid.groupSettings.showDropArea = this.grid.groupSettings.columns.length == 0 ? true : false;
}
}
|