SenyaMur / ag-grid-odata

Implementation Odata ServerSideDatasource for ag-grid
MIT License
19 stars 6 forks source link

Welcome to ag-grid-odata 👋

downloads License: MIT

Odata provider for ag-grid

Ag-Grid Server Side Row Model demo

Installation

npm install ag-grid-odata

Usage

Client mode

Features in client mode:

Code example ```js import OdataProvider from 'ag-grid-odata' import { AgGridReact, AgGridColumn } from "@ag-grid-community/react" import "@ag-grid-community/all-modules/dist/styles/ag-grid.css"; import "@ag-grid-community/all-modules/dist/styles/ag-theme-balham-dark.css"; const onGridReady = (params) => { const gridApi = params.api; gridApi.setDatasource( new OdataProvider({ callApi: (options) =>fetch(`yourOdataUrlService/EntitySet${options}`) .then(resp=>resp.json()) .then(resp => { return resp.data }); }) ) } function(props) MyGrid(){ return ( ) } ```

Server mode

Features in client mode:

Code example ```js import OdataProvider from 'ag-grid-odata' import { AgGridReact, AgGridColumn } from "@ag-grid-community/react" import { AllModules } from "@ag-grid-enterprise/all-modules"; import "@ag-grid-community/all-modules/dist/styles/ag-grid.css"; import "@ag-grid-community/all-modules/dist/styles/ag-theme-balham-dark.css"; const onGridReady = (params) => { const gridApi = params.api; gridApi.setServerSideDatasource( new OdataProvider({ callApi: (options) =>fetch(`yourOdataUrlService/EntitySet${options}`) .then(resp=>resp.json()) .then(resp => { return resp.data }); }) ) } function(props) MyGrid(){ return ( { return data && data.childCount; }} defaultColDef={{ sortable: true, resizable: true, enablePivot: true, allowedAggFuncs: ['sum', 'min', 'max', 'avg', 'count'], filterParams: { newRowsAction: 'keep', browserDatePicker: true } }} > ) } ```