Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mariuszfoltak/angular2-datatable
DataTable - Simple table component with sorting and pagination for Angular2
https://github.com/mariuszfoltak/angular2-datatable
Last synced: about 1 month ago
JSON representation
DataTable - Simple table component with sorting and pagination for Angular2
- Host: GitHub
- URL: https://github.com/mariuszfoltak/angular2-datatable
- Owner: mariuszfoltak
- Created: 2016-03-20T14:06:44.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-03T12:46:13.000Z (over 6 years ago)
- Last Synced: 2024-10-02T13:47:02.349Z (2 months ago)
- Language: TypeScript
- Homepage:
- Size: 496 KB
- Stars: 202
- Watchers: 18
- Forks: 183
- Open Issues: 96
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
- awesome-angular-components - angular2-datatable - DataTable - Simple table component with sorting and pagination for Angular2. (Uncategorized / Uncategorized)
- awesome-angular - angular2-datatable - DataTable - Simple table component with sorting and pagination for Angular2. (Uncategorized / Uncategorized)
- awesome-angular-components - angular2-datatable - DataTable - Simple table component with sorting and pagination for Angular2. (Uncategorized / Uncategorized)
- awesome-angular-components - mariuszfoltak/angular2-datatable - DataTable - Simple table component with sorting and pagination for Angular2 (UI Components / Table)
README
# Table component with sorting and pagination for Angular2
[![npm version](https://badge.fury.io/js/angular2-datatable.svg)](https://badge.fury.io/js/angular2-datatable)
[![Build Status](https://travis-ci.org/mariuszfoltak/angular2-datatable.svg?branch=master)](https://travis-ci.org/mariuszfoltak/angular2-datatable)
[![Code Climate](https://codeclimate.com/github/mariuszfoltak/angular2-datatable/badges/gpa.svg)](https://codeclimate.com/github/mariuszfoltak/angular2-datatable)
[![Test Coverage](https://codeclimate.com/github/mariuszfoltak/angular2-datatable/badges/coverage.svg)](https://codeclimate.com/github/mariuszfoltak/angular2-datatable/coverage)
[![npm downloads](https://img.shields.io/npm/dm/angular2-datatable.svg)](https://npmjs.org/angular2-datatable)## Demo
Check [live demo](http://plnkr.co/edit/PxBaZs?p=preview) in plunker
## Installation
```
npm i -S angular2-datatable
```## Usage example
AppModule.ts
```typescript
import {NgModule} from "@angular/core";
...
import {DataTableModule} from "angular2-datatable";@NgModule({
imports: [
...
DataTableModule
],
...
})
export class AppModule {}
```AppComponent.html
```html
Name
Age
City
{{item.name}}
{{item.email}}
{{item.age}}
{{item.city | uppercase}}
```
## API
### `mfData` directive
- selector: `table[mfData]`
- exportAs: `mfDataTable`
- inputs
- `mfData: any[]` - array of data to display in table
- `mfRowsOnPage: number` - number of rows should be displayed on page (default: 1000)
- `mfActivePage: number` - page number (default: 1)
- `mfSortBy: any` - sort by parameter
- `mfSortOrder: string` - sort order parameter, "asc" or "desc"
- outputs
- `mfSortByChange: any` - sort by parameter
- `mfSortOrderChange: any` - sort order parameter
### `mfDefaultSorter` component- selector: `mfDefaultSorter`
- inputs
- `by: any` - specify how to sort data (argument for lodash function [_.sortBy ](https://lodash.com/docs#sortBy))
### `mfBootstrapPaginator` component
Displays buttons for changing current page and number of displayed rows using bootstrap template (css for bootstrap is required). If array length is smaller than current displayed rows on page then it doesn't show button for changing page. If array length is smaller than min value rowsOnPage then it doesn't show any buttons.- selector: `mfBootstrapPaginator`
- inputs
- `rowsOnPageSet: number` - specify values for buttons to change number of diplayed rows