1 import { HttpParams } from '@angular/common/http';
3 import { PageInfo } from './cd-table-paging';
5 export class CdTableFetchDataContext {
7 resetData: true, // Force data table to show no data
8 displayError: true // Show an error panel above the data table
12 * The function that should be called from within the error handler
13 * of the 'fetchData' function to display the error panel and to
14 * reset the data table to the correct state.
17 pageInfo: PageInfo = new PageInfo();
21 constructor(error: () => void) {
25 toParams(): HttpParams {
26 if (this.pageInfo.limit === null) {
27 this.pageInfo.limit = 0;
32 if (!this.sort || this.sort.length < 2) {
35 return new HttpParams({
37 offset: String(this.pageInfo.offset * this.pageInfo.limit),
38 limit: String(this.pageInfo.limit),