|
<button (click)='show($event)'>showSpinner</button>
<button (click)='hide($event)'>hideSpinner</button>
<ejs-grid #grid [dataSource]='data' >
<e-columns>
. . .
</e-columns>
</ejs-grid>
show(args:any){
this.Grid.showSpinner();
}
hide(args:any){
this.Grid.hideSpinner();
} |
|
import { setSpinner } from '@syncfusion/ej2-popups';
setSpinner({ template: '<div style="width:100%;height:100%" class="custom-rolling"><div></div></div>'});
@Component({
selector: 'app-root',
template: `<button ej-button class='e-flat' (click)='click()'>Click</button>
<button (click)='show()'>show spinner</button>
<button (click)='hide()'>hide spinner</button>
<ejs-grid [dataSource]='data' id="gridcomp" allowPaging='true'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right'></e-column>
<e-column field='CustomerName' headerText='Customer Name' [showInColumnChooser]='false'></e-column>
. . . .
</ejs-grid>`,
styleUrls: ['./app.component.css'],
encapsulation: ViewEncapsulation.Emulated
})
export class AppComponent implements OnInit {
public data: Object[];
@ViewChild(GridComponent) public gridInit: GridComponent;
ngOnInit(): void {
}
show(args:any){
this.gridInit.showSpinner();
}
click(): void {
this.gridInit.dataSource = orderData;
}
hide(args:any){
this.gridInit.hideSpinner();
}
}
|
|
[Grid]
<div id='customSpinner'></div>
<ejs-grid #grid [dataSource]='data' (load)='load($event)'>
<e-columns>
. . .
</e-columns>
</ejs-grid>
ngOnInit(): void {
//here we can show the custom spinner before the grid append to dom element
let spinnerTarget: HTMLElement = document.querySelector('#customSpinner') as HTMLElement;
createSpinner({ target: spinnerTarget , width: '20px' });
showSpinner(spinnerTarget);
}
[Load event]
<script>
load(args:any){
//here we can hide the default waiting popup spinner for Grid
this.Grid.element.querySelector('.e-spinner-pane').style.display = "none";
}
</script> |
|
ngAfterContentChecked(){
this.Grid.showSpinner();
}
|