odata-table
odata-table simplifies quering OData V4 APIs using odata-query, odata-data-source, and material-dynamic-table.
Currently under development.
Installation
To install dependencies mentioned above, run the following:
npm i odata-query material-dynamic-table @angular/material @angular/cdk
To install odata-table run:
npm i odata-table
Getting started
In your module include the following imports:
import { CellService } from 'material-dynamic-table';
import { OdataTableModule, OdataTextCellComponent, OdataDateCellComponent } from 'odata-table';
add OdataTableModule to the imports:
imports: [
BrowserModule,
BrowserAnimationsModule,
OdataTableModule
],
register string, and date cells in the constructor:
export class AppModule {
constructor(private readonly cellService: CellService) {
cellService.registerCell('string', OdataTextCellComponent);
cellService.registerCell('date', OdataDateCellComponent);
}
}
Usage
<mat-odata-table url="https://services.odata.org/V4/OData/OData.svc/Products">
<mat-odata-field name="Name" displayName="Name" type="string"></mat-odata-field>
<mat-odata-field name="Description" displayName="Description" type="string"></mat-odata-field>
<mat-odata-field name="ReleaseDate" displayName="Release Date" type="date">
<mat-odata-field-option name="format" value="long"></mat-odata-field-option>
</mat-odata-field>
<mat-odata-field name="ProductDetail.Details" displayName="Details" type="string"></mat-odata-field>
<mat-odata-field name="Supplier.Name" displayName="Supplier" type="string"></mat-odata-field>
</mat-odata-table>