Convert Figma logo to code with AI

swimlane logongx-datatable

✨ A feature-rich yet lightweight data-table crafted for Angular

4,625
1,682
4,625
899

Top Related Projects

12,496

The best JavaScript Data Table for building Enterprise Applications. Supports React / Angular / Vue / Plain JavaScript.

24,859

🤖 Headless UI for building powerful tables & datagrids for TS/JS - React-Table, Vue-Table, Solid-Table, Svelte-Table

JavaScript data grid with a spreadsheet look & feel. Works with React, Angular, and Vue. Supported by the Handsontable team ⚡

A lightning fast JavaScript grid/spreadsheet

Business React components for Bootstrap and Material-UI

Quick Overview

ngx-datatable is a powerful and feature-rich Angular component for creating data tables. It offers a wide range of functionalities including sorting, filtering, pagination, and row selection, making it suitable for displaying large datasets in a user-friendly manner.

Pros

  • Highly customizable with numerous configuration options
  • Excellent performance, even with large datasets
  • Responsive design that works well on various screen sizes
  • Active development and community support

Cons

  • Steep learning curve due to its extensive API
  • Documentation can be overwhelming for beginners
  • Some users report occasional issues with complex setups
  • Limited built-in theming options

Code Examples

  1. Basic table setup:
import { Component } from '@angular/core';

@Component({
  selector: 'app-basic-table',
  template: `
    <ngx-datatable
      [rows]="rows"
      [columns]="columns">
    </ngx-datatable>
  `
})
export class BasicTableComponent {
  rows = [
    { name: 'Austin', gender: 'Male', company: 'Swimlane' },
    { name: 'Dany', gender: 'Female', company: 'KFC' },
    { name: 'Molly', gender: 'Female', company: 'Burger King' },
  ];
  columns = [
    { prop: 'name' },
    { name: 'Gender' },
    { name: 'Company' }
  ];
}
  1. Enabling sorting and pagination:
@Component({
  selector: 'app-sorted-paginated-table',
  template: `
    <ngx-datatable
      [rows]="rows"
      [columns]="columns"
      [sortable]="true"
      [headerHeight]="50"
      [footerHeight]="50"
      [rowHeight]="50"
      [limit]="10">
    </ngx-datatable>
  `
})
export class SortedPaginatedTableComponent {
  // rows and columns definitions...
}
  1. Custom column template:
@Component({
  selector: 'app-custom-column-table',
  template: `
    <ngx-datatable [rows]="rows">
      <ngx-datatable-column name="Name" prop="name"></ngx-datatable-column>
      <ngx-datatable-column name="Actions">
        <ng-template let-row="row" ngx-datatable-cell-template>
          <button (click)="onAction(row)">Edit</button>
        </ng-template>
      </ngx-datatable-column>
    </ngx-datatable>
  `
})
export class CustomColumnTableComponent {
  // rows definition...
  onAction(row) {
    console.log('Edit', row);
  }
}

Getting Started

  1. Install the package:

    npm install @swimlane/ngx-datatable
    
  2. Import the module in your app.module.ts:

    import { NgxDatatableModule } from '@swimlane/ngx-datatable';
    
    @NgModule({
      imports: [NgxDatatableModule]
    })
    export class AppModule { }
    
  3. Use the component in your template:

    <ngx-datatable [rows]="rows" [columns]="columns"></ngx-datatable>
    
  4. Define your data and columns in the component:

    export class MyComponent {
      rows = [/* your data */];
      columns = [/* your column definitions */];
    }
    

Competitor Comparisons

12,496

The best JavaScript Data Table for building Enterprise Applications. Supports React / Angular / Vue / Plain JavaScript.

Pros of ag-grid

  • More feature-rich with advanced functionalities like pivoting, grouping, and aggregation
  • Better performance for handling large datasets (100,000+ rows)
  • Extensive documentation and community support

Cons of ag-grid

  • Steeper learning curve due to its complexity
  • Paid enterprise version required for some advanced features
  • Larger bundle size compared to ngx-datatable

Code Comparison

ngx-datatable:

<ngx-datatable
  [rows]="rows"
  [columns]="columns"
  [scrollbarH]="true"
  [headerHeight]="50"
  [rowHeight]="50">
</ngx-datatable>

ag-grid:

<ag-grid-angular
  style="width: 100%; height: 500px;"
  class="ag-theme-alpine"
  [rowData]="rowData"
  [columnDefs]="columnDefs">
</ag-grid-angular>

Both libraries offer similar basic setup, but ag-grid provides more configuration options and features out of the box. ngx-datatable focuses on simplicity and ease of use, while ag-grid offers a more comprehensive solution for complex data grid requirements. The choice between the two depends on the specific needs of your project, considering factors such as performance requirements, feature set, and budget constraints.

24,859

🤖 Headless UI for building powerful tables & datagrids for TS/JS - React-Table, Vue-Table, Solid-Table, Svelte-Table

Pros of TanStack Table

  • Framework-agnostic, supporting React, Vue, Solid, and Svelte
  • Highly flexible and customizable with a powerful plugin system
  • Excellent TypeScript support and type safety

Cons of TanStack Table

  • Steeper learning curve due to its flexibility and API complexity
  • Requires more setup and configuration for basic use cases
  • Less out-of-the-box styling and theming options

Code Comparison

ngx-datatable:

<ngx-datatable [rows]="rows" [columns]="columns">
</ngx-datatable>

TanStack Table (React example):

const table = useReactTable({
  data,
  columns,
  getCoreRowModel: getCoreRowModel(),
})
return <TableComponent table={table} />

Summary

ngx-datatable is an Angular-specific table component with a simpler API and more built-in features, making it easier to set up for basic use cases. It offers good performance and a variety of built-in themes.

TanStack Table is a more versatile and powerful solution, supporting multiple frameworks and offering greater customization. However, it requires more initial setup and has a steeper learning curve. It's particularly well-suited for complex table requirements and projects using TypeScript.

Choose ngx-datatable for quick Angular-specific implementations, and TanStack Table for cross-framework flexibility and advanced customization needs.

JavaScript data grid with a spreadsheet look & feel. Works with React, Angular, and Vue. Supported by the Handsontable team ⚡

Pros of Handsontable

  • More feature-rich, including advanced functionalities like data validation, filtering, and sorting
  • Supports multiple frameworks (React, Angular, Vue) and vanilla JavaScript
  • Extensive documentation and examples

Cons of Handsontable

  • Larger bundle size due to its comprehensive feature set
  • Steeper learning curve for basic implementations
  • Commercial license required for some features and use cases

Code Comparison

ngx-datatable:

<ngx-datatable
  [rows]="rows"
  [columns]="columns"
  [scrollbarH]="true"
  [headerHeight]="50"
  [rowHeight]="50">
</ngx-datatable>

Handsontable:

<hot-table
  [data]="data"
  [colHeaders]="true"
  [rowHeaders]="true"
  [height]="400"
  licenseKey="non-commercial-and-evaluation">
</hot-table>

Both libraries offer powerful data grid solutions, but they cater to different needs. ngx-datatable is lightweight and specifically designed for Angular applications, making it easier to integrate into Angular projects. It's open-source and free to use, which can be advantageous for smaller projects or teams with budget constraints.

Handsontable, on the other hand, provides a more comprehensive set of features and supports multiple frameworks. It's particularly well-suited for complex data manipulation tasks and applications requiring spreadsheet-like functionality. However, its commercial licensing model may be a consideration for some projects.

A lightning fast JavaScript grid/spreadsheet

Pros of SlickGrid

  • Highly performant with large datasets, capable of handling millions of rows
  • Extensive customization options and plugin ecosystem
  • Supports complex cell editors and formatters

Cons of SlickGrid

  • Steeper learning curve due to its complexity and extensive API
  • Less modern UI out-of-the-box compared to ngx-datatable
  • Requires more manual configuration for responsive design

Code Comparison

SlickGrid:

var grid = new Slick.Grid("#myGrid", data, columns, options);
grid.onCellChange.subscribe(function (e, args) {
  console.log("Cell changed: ", args);
});

ngx-datatable:

<ngx-datatable
  [rows]="rows"
  [columns]="columns"
  (activate)="onActivate($event)"
>
</ngx-datatable>

SlickGrid offers more granular control over grid events and behavior, while ngx-datatable provides a more declarative, Angular-friendly approach. SlickGrid's JavaScript API allows for fine-tuned customization, whereas ngx-datatable leverages Angular's template syntax for easier integration with Angular applications.

Both libraries have their strengths, with SlickGrid excelling in performance and customization for complex scenarios, and ngx-datatable offering a more modern, Angular-native experience with easier setup for basic use cases.

Business React components for Bootstrap and Material-UI

Pros of devextreme-reactive

  • More comprehensive set of UI components beyond just data tables
  • Offers integration with popular frameworks like React, Vue, and Angular
  • Provides advanced features like pivot grids and chart integration

Cons of devextreme-reactive

  • Steeper learning curve due to its extensive feature set
  • Larger bundle size, which may impact application performance
  • Commercial licensing for some features, potentially increasing costs

Code Comparison

ngx-datatable:

<ngx-datatable
  [rows]="rows"
  [columns]="columns"
  [scrollbarH]="true"
  [headerHeight]="50"
  [rowHeight]="50">
</ngx-datatable>

devextreme-reactive:

<Grid
  rows={rows}
  columns={columns}>
  <Table />
  <TableHeaderRow />
</Grid>

Summary

While ngx-datatable focuses specifically on data tables with a simpler API, devextreme-reactive offers a broader range of UI components and more advanced features. ngx-datatable may be easier to implement for basic use cases, but devextreme-reactive provides more flexibility and integration options for complex applications. The choice between the two depends on project requirements, budget constraints, and the desired level of customization and features.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

ngx-datatable

Join the chat at https://gitter.im/swimlane/ngx-datatable Code Climate Test Coverage npm version npm downloads

ngx-datatable is an Angular component for presenting large and complex data. It has all the features you would expect from any other table but in a light package with no external dependencies. The table was designed to be extremely flexible and light; it doesn't make any assumptions about your data or how you: filter, sort or page it.

It was built for modern browsers using TypeScript, CSS3 and HTML5 and Angular 8.0.0. This is the sister project of the angular-data-table that is designed for Angular 1.x.

Check out the documentation & demos for more information!

See the changelog for recent changes.

Features

  • Handle large data sets ( Virtual DOM )
  • Expressive Header and Cell Templates
  • Horizontal & Vertical Scrolling
  • Column Reordering & Resizing
  • Client/Server side Pagination & Sorting
  • Intelligent Column Width Algorithms ( Force-fill & Flex-grow )
  • Integrated Pager
  • Cell & Row Selection ( Single, Multi, Keyboard, Checkbox )
  • Fixed AND Fluid height
  • Left and Right Column Pinning
  • Row Detail View
  • Decoupled theme'ing with included Google Material theme
  • Light codebase / No external dependencies
  • AoT Compilation Support
  • Universal Support

Installation

To use ngx-datatable in your project install it via npm:

npm i @swimlane/ngx-datatable --save

Credits

ngx-datatable is a Swimlane open-source project; we believe in giving back to the open-source community by sharing some of the projects we build for our application. Swimlane is an automated cyber security operations and incident response platform that enables cyber security teams to leverage threat intelligence, speed up incident response and automate security operations.

SecOps Hub is an open, product-agnostic, online community for security professionals to share ideas, use cases, best practices, and incident response strategies.

NPM DownloadsLast 30 Days