@lkmylin/angular-datatable v0.0.6
angular-datatable
This project was generated with Angular CLI version 1.6.4 and packaged with ng-packagr. It provides an AOT-compatible data table component for use with angular projects.
Installation
Run npm install @lkmylin/angular-datatable --save
Implementation
In your bootstrap module:
import { HttpModule } from "@angular/http";import { DataTableModule } from "@lkmylin/angular-datatable";import { StateManagerModule, StateManager } from "@lkmylin/angular-statemanager";add
HttpModuleto your importsadd
StateManagerto your providersadd
{provide: "window", useValue: window}to your providersadd a DataTableComponent:
<lkm-datatable tableid="table1" [datasource]="dataSource" [pagesize]="10" [pagerdisplaysize]="10">Title</lkm-datatable>dataSourcecan be an array or any URL that returns json, e.g. a static file or REST API. It must return an array of objects of the following form:{Column1: "Column1Value", Column2: "Column2Value", Column3: "Column3Value" }
If need the table to update dynamically in response to datasource changes, use an array
If you use a string literal for
dataSource, remember to wrap it in single quotes
pagesizeis the number of data rows per page in the tablepagerdisplaysizeis the number of page numbers that get displayed in the pager, e.g. if you set it to 5, your pager will be formatted like this:<< < ... 1 2 3 4 5 ... > >>