@dlarsson-se/sortable-table
v0.2.5
Published
Sortable HTML table.
Downloads
8
Readme
Sortable Table
A library for sorting of table data.
Installation
npm install @dlarsson-se/sortable-table -S
StackBlitz
Example Usage
app.module.ts
import { SortableTableModule } from '@dlarsson-se/sortable-table;
@NgModule({
imports: [ SortableTableModule.forRoot() ]
})
export class AppModule { }
app.component.html
<table sortableTable [sortableData]="tableData">
<thead>
<tr>
<th sortBy="id">ID</th>
<th sortBy="name">Name</th>
<th sortBy="position">Position</th>
<th sortBy="salary">Salary</th>
<th sortBy="start_date">Start Date</th>
<th sortBy="office">Office</th>
<th sortBy="extn">Extension</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of tableData">
<td>{{data.id}}</td>
<td>{{data.name}}</td>
<td>{{data.position}}</td>
<td>{{data.salary}}</td>
<td>{{data.start_date}}</td>
<td>{{data.office}}</td>
<td>{{data.extn}}</td>
</tr>
</tbody>
</table>
Tests
npm test
Contributing
In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.
npm run format
npm run lint