Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @nelsontkq/ng-datatable with all npm packages installed. Try it out:

require("rxjs/package.json"); // rxjs is a peer dependency. var ngDatatable = require("@nelsontkq/ng-datatable")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@nelsontkq/ng-datatable v2.1.2

DataTable component for Angular framework

Table component with sorting and pagination for Angular

It is a forked version of ng-datatable updated to Angular 7.

npm version


npm i @nelsontkq/ng-datatable --save

Usage example


import {NgModule} from "@angular/core";
import {DataTableModule} from "@nelsontkq/ng-datatable";

    imports: [
export class AppModule {



<table class="table table-striped" [mfData]="data" #mf="mfDataTable" [mfRowsOnPage]="5">
        <th style="width: 20%">
            <mfDefaultSorter by="name">Name</mfDefaultSorter>
        <th style="width: 50%">
            <mfDefaultSorter by="email">Email</mfDefaultSorter>
        <th style="width: 10%">
            <mfDefaultSorter by="age">Age</mfDefaultSorter>
        <th style="width: 20%">
            <mfDefaultSorter by="city">City</mfDefaultSorter>
    <tr *ngFor="let item of">
        <td class="text-right">{{item.age}}</td>
        <td>{{ | uppercase}}</td>
        <td colspan="4">
            <mfBootstrapPaginator [rowsOnPageSet]="[5,10,25]"></mfBootstrapPaginator>


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 )

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
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free