Starting with version 3.1.0, the Kendo UI Grid for Angular has a built-in progress bar.
See sample documentation here .
The basic premise is to set the property[loading] kendo-grid :
<kendo-grid
[loading]="yourService.loading"
...
>
</kendo-grid>
And then in your class of service, set the boolean variable to true or false, depending on the state of your queries to remote data sources:
export abstract class NorthwindService extends BehaviorSubject<GridDataResult> {
public loading: boolean;
private BASE_URL = 'https://odatasampleservices.azurewebsites.net/V4/Northwind/Northwind.svc/';
constructor(
private http: HttpClient,
protected tableName: string
) {
super(null);
}
public query(state: any): void {
this.fetch(this.tableName, state)
.subscribe(x => super.next(x));
}
protected fetch(tableName: string, state: any): Observable<GridDataResult> {
const queryStr = '${toODataString(state)}&$count=true';
this.loading = true;
return this.http
.get('${this.BASE_URL}${tableName}?${queryStr}')
.pipe(
map(response => (<GridDataResult>{
data: response['value'],
total: parseInt(response['@odata.count'], 10)
})),
tap(() => this.loading = false)
);
}
}
source
share