This repository was archived by the owner on Jun 1, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 119
GraphQL
Ghislain B edited this page Oct 25, 2017
·
51 revisions
GraphQL Backend Service to get data from a backend server with the help of GraphQL.
To connect a backend service into Angular-Slickgrid
, you simply need to modify your gridOptions
and add a declaration of onBackendEventChanged
. See below for the signature and an example further down below.
onBackendEventApi: {
onInit?: (query: string) => Promise<any> | Observable<any>;
preProcess?: () => void;
process: (query: string) => Promise<any> | Observable<any>;
postProcess: (response: any) => void;
service: BackendService;
filterTypingDebounce?: number;
}
As you can see, you mainly need to define which service to use (GridODataService or GraphQLService) and finally add the process
and postProcess
callback.
Note: Pagination is optional and if not defined, it will use what is set in the Angular-Slickgrid - Global Options
this.gridOptions = {
enableFiltering: true,
enablePagination: true,
pagination: {
pageSizes: [10, 15, 20, 25, 30, 40, 50, 75, 100],
pageSize: defaultPageSize,
totalItems: 0
},
onBackendEventApi: {
onInit: (query) => this.getCustomerApiCall(query),
preProcess: () => this.displaySpinner(true),
process: (query) => this.getCustomerApiCall(query),
postProcess: (response) => {
this.displaySpinner(false);
this.getCustomerCallback(response);
},
filterTypingDebounce: 700,
service: this.graphqlService
}
};
// Web API call
getCustomerApiCall(graphqlQuery) {
return this.http.post(`/graphql`, { query: graphqlQuery }).toPromise();
}
For the implementation of all 3 actions (filtering, sorting, pagination) with your GraphQL Server, please refer to the sections below to configure your GraphQL Schema accordingly.
Contents
- Angular-Slickgrid Uncyclo
- Installation
- Styling
- Interfaces/Models
- Testing Patterns
- Column Functionalities
- Global Grid Options
- Localization
- Events
- Grid Functionalities
- Auto-Resize / Resizer Service
- Resize by Cell Content
- Composite Editor
- Context Menu
- Custom Tooltip
- Add/Delete/Update or Highlight item
- Dynamically Change Row CSS Classes
- Excel Copy Buffer
- Export to Excel
- Export to File (CSV/Txt)
- Grid State & Presets
- Grouping & Aggregators
- Row Detail
- SlickGrid Controls
- SlickGrid Plugins
- Pinning (frozen) of Columns/Rows
- Tree Data Grid
- SlickGrid & DataView objects
- Addons (controls/plugins)
- Backend Services