19.0.0 • Published 10 months ago
@pascalhonegger/ng-datatable v19.0.0
Table component with sorting and pagination for Angular
It is a forked version of ng-datatable updated to Angular 19 and Signals.
Installation
npm i @pascalhonegger/ng-datatable --saveUsage example
AppModule.ts
import {NgModule} from "@angular/core";
...
import {DataTableModule} from "@pascalhonegger/ng-datatable";
@NgModule({
imports: [
...
DataTableModule
],
...
})
export class AppModule {
}AppComponent.html
<table class="table table-striped" [mfData]="data" #mf="mfDataTable" [mfRowsOnPage]="5">
<thead>
<tr>
<th style="width: 20%">
<mfDefaultSorter by="name">Name</mfDefaultSorter>
</th>
<th style="width: 50%">
<mfDefaultSorter by="email">Email</mfDefaultSorter>
</th>
<th style="width: 10%">
<mfDefaultSorter by="age">Age</mfDefaultSorter>
</th>
<th style="width: 20%">
<mfDefaultSorter by="city">City</mfDefaultSorter>
</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of mf.data">
<td>{{item.name}}</td>
<td>{{item.email}}</td>
<td class="text-right">{{item.age}}</td>
<td>{{item.city | uppercase}}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="4">
<mfBootstrapPaginator [rowsOnPageSet]="[5,10,25]"></mfBootstrapPaginator>
</td>
</tr>
</tfoot>
</table>API
mfData directive
- selector:
table[mfData] - exportAs:
mfDataTable - inputs
mfData: any[]- array of data to display in tablemfRowsOnPage: number- number of rows should be displayed on page (default: 1000)mfActivePage: number- page number (default: 1)mfSortBy: any- sort by parametermfSortOrder: "asc" | "desc"- sort order parameter
outputs
mfSortByChange: any- sort by parametermfSortOrderChange: any- sort order parameter
mfDefaultSorter component
- selector:
mfDefaultSorter inputs
by: any- specify how to sort data (argument for lodash function _.sortBy )
mfBootstrapPaginator component
Displays buttons for changing current page and number of displayed rows using bootstrap template (css for bootstrap 5 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
19.0.0
10 months ago
18.0.0
1 year ago
17.0.0
2 years ago
16.0.2
3 years ago
16.0.1
3 years ago
16.0.0
3 years ago
15.1.2
3 years ago
15.1.1
3 years ago
15.1.0
3 years ago
15.0.0
3 years ago
14.0.1
3 years ago
14.0.0
3 years ago
13.1.0
4 years ago
13.0.0
4 years ago
12.0.0
4 years ago
12.0.1
4 years ago
11.1.0
5 years ago
11.0.1
5 years ago
11.0.0
5 years ago
10.0.0
5 years ago
9.0.1
6 years ago
9.0.0
6 years ago
8.0.0
6 years ago
2.0.0
7 years ago
1.0.0
7 years ago