UNPKG

angular2-data-table

Version:

angular2-data-table is a Angular2 component for presenting large and complex data.

43 lines (35 loc) 795 B
import { Component } from '@angular/core'; @Component({ selector: 'client-paging-demo', template: ` <div> <h3>Client-side Paging</h3> <swui-datatable class="material" [rows]="rows" [columns]="[{name:'Name'},{name:'Gender'},{name:'Company'}]" [columnMode]="'force'" [headerHeight]="50" [footerHeight]="50" [rowHeight]="'auto'" [limit]="10"> </swui-datatable> </div> ` }) export class ClientPagingComponent { rows = []; constructor() { this.fetch((data) => { this.rows = data; }); } fetch(cb) { const req = new XMLHttpRequest(); req.open('GET', `assets/data/company.json`); req.onload = () => { cb(JSON.parse(req.response)); }; req.send(); } }