@dlarsson-se/sortable-table
TypeScript icon, indicating that this package has built-in type declarations

0.2.5 • Public • Published

Sortable Table

A library for sorting of table data.

Installation

npm install @dlarsson-se/sortable-table -S

StackBlitz

StackBlitz Example

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

Readme

Keywords

Package Sidebar

Install

npm i @dlarsson-se/sortable-table

Weekly Downloads

14

Version

0.2.5

License

ISC

Unpacked Size

300 kB

Total Files

33

Last publish

Collaborators

  • dls