Top Related Projects
JavaScript data grid with a spreadsheet look & feel. Works with React, Angular, and Vue. Supported by the Handsontable team ⚡
The best JavaScript Data Table for building Enterprise Applications. Supports React / Angular / Vue / Plain JavaScript.
🤖 Headless UI for building powerful tables & datagrids for TS/JS - React-Table, Vue-Table, Solid-Table, Svelte-Table
React components for efficiently rendering large lists and tabular data
A lightning fast JavaScript grid/spreadsheet
Build interactive dashboards in minutes.
Quick Overview
Frappe DataTable is a lightweight, high-performance JavaScript library for creating interactive data tables. It offers a modern and customizable solution for displaying and manipulating tabular data in web applications, with features like sorting, filtering, and editing.
Pros
- Lightweight and fast performance
- Highly customizable with a rich set of features
- Supports virtual DOM for efficient rendering of large datasets
- Seamless integration with Frappe Framework and other web applications
Cons
- Limited documentation compared to some more established data table libraries
- Smaller community and ecosystem compared to alternatives like DataTables
- May require additional setup for advanced features or complex use cases
Code Examples
- Basic table initialization:
const datatable = new DataTable('#datatable', {
columns: ['Name', 'Age', 'City'],
data: [
['John Doe', 30, 'New York'],
['Jane Smith', 25, 'London'],
['Bob Johnson', 35, 'Paris']
]
});
- Adding sorting functionality:
const datatable = new DataTable('#datatable', {
columns: ['Name', 'Age', 'City'],
data: [...],
sortable: true
});
- Enabling inline editing:
const datatable = new DataTable('#datatable', {
columns: ['Name', 'Age', 'City'],
data: [...],
editable: true,
inlineFilters: true
});
Getting Started
To use Frappe DataTable in your project, follow these steps:
- Include the necessary files in your HTML:
<link rel="stylesheet" href="https://unpkg.com/frappe-datatable/dist/frappe-datatable.min.css">
<script src="https://unpkg.com/frappe-datatable/dist/frappe-datatable.min.js"></script>
- Create a container element for your table:
<div id="datatable"></div>
- Initialize the DataTable in your JavaScript:
const datatable = new DataTable('#datatable', {
columns: ['Name', 'Age', 'City'],
data: [
['John Doe', 30, 'New York'],
['Jane Smith', 25, 'London'],
['Bob Johnson', 35, 'Paris']
]
});
This will create a basic data table with the specified columns and data. You can further customize the table by adding options for sorting, filtering, editing, and more.
Competitor Comparisons
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 with advanced functionalities like filtering, sorting, and validation
- Extensive documentation and community support
- Offers both open-source and commercial versions with additional features
Cons of Handsontable
- Larger file size and potentially heavier performance impact
- Steeper learning curve due to its extensive API and options
- Commercial license required for some advanced features
Code Comparison
Handsontable:
const hot = new Handsontable(container, {
data: data,
rowHeaders: true,
colHeaders: true,
filters: true,
dropdownMenu: true
});
Datatable:
const datatable = new DataTable(container, {
columns: columns,
data: data
});
Handsontable offers more built-in features in its configuration, while Datatable focuses on simplicity and lightweight implementation. Handsontable provides a more comprehensive solution out-of-the-box, whereas Datatable may require additional customization for advanced functionalities.
Both libraries aim to create interactive data tables, but Handsontable is more suited for complex enterprise applications, while Datatable is ideal for simpler, performance-focused implementations. The choice between the two depends on the specific project requirements, performance considerations, and desired level of customization.
The best JavaScript Data Table for building Enterprise Applications. Supports React / Angular / Vue / Plain JavaScript.
Pros of ag-Grid
- More feature-rich with advanced functionality like pivoting, grouping, and filtering
- Extensive documentation and community support
- Better performance for large datasets
Cons of ag-Grid
- Steeper learning curve due to complexity
- Larger file size and potential performance impact for smaller applications
- Commercial license required for some advanced features
Code Comparison
ag-Grid:
const gridOptions = {
columnDefs: [
{ field: 'name' },
{ field: 'age' }
],
rowData: [
{ name: 'John', age: 35 },
{ name: 'Alice', age: 28 }
]
};
Datatable:
const datatable = new DataTable('#myTable', {
columns: ['Name', 'Age'],
data: [
['John', 35],
['Alice', 28]
]
});
Both libraries offer ways to create data grids, but ag-Grid provides more configuration options and a more structured approach. Datatable has a simpler API, making it easier to set up for basic use cases.
ag-Grid is better suited for complex enterprise applications with large datasets and advanced requirements. Datatable is more appropriate for simpler projects or when a lightweight solution is needed. The choice between the two depends on the specific needs of the project, considering factors like performance, features, and ease of use.
🤖 Headless UI for building powerful tables & datagrids for TS/JS - React-Table, Vue-Table, Solid-Table, Svelte-Table
Pros of Table
- More flexible and customizable, with support for various UI frameworks
- Better TypeScript support and type safety
- Extensive documentation and active community support
Cons of Table
- Steeper learning curve due to its more complex API
- Larger bundle size, which may impact performance for smaller projects
Code Comparison
Table:
import { useTable } from '@tanstack/react-table'
function Table({ data, columns }) {
const tableInstance = useTable({ columns, data })
// ... render table using tableInstance
}
Datatable:
const datatable = new DataTable('#myTable', {
columns: [...],
data: [...],
// ... other options
})
Key Differences
- Table is a headless UI library, providing more flexibility in styling and rendering
- Datatable offers a more opinionated, out-of-the-box solution with less customization
- Table has better support for modern React patterns and hooks
- Datatable is more suitable for simpler use cases and quick implementation
Use Cases
- Choose Table for complex, highly customized table requirements in React applications
- Opt for Datatable when you need a quick, ready-to-use table solution with minimal setup
Community and Maintenance
- Table has a larger and more active community, with frequent updates
- Datatable has a smaller but dedicated community, with less frequent updates
React components for efficiently rendering large lists and tabular data
Pros of react-virtualized
- More comprehensive set of components for virtualized rendering
- Better performance for large datasets due to windowing technique
- Extensive documentation and examples
Cons of react-virtualized
- Steeper learning curve due to more complex API
- Requires React as a dependency, limiting use in non-React projects
- Larger bundle size compared to datatable
Code Comparison
react-virtualized:
import { Table, Column } from 'react-virtualized';
<Table
width={300}
height={300}
headerHeight={20}
rowHeight={30}
rowCount={100}
rowGetter={({ index }) => data[index]}
>
<Column label="Name" dataKey="name" width={100} />
<Column label="Age" dataKey="age" width={100} />
</Table>
datatable:
import DataTable from 'frappe-datatable';
const datatable = new DataTable('#datatable', {
columns: ['Name', 'Age'],
data: [
['John', 30],
['Jane', 25]
]
});
react-virtualized offers more flexibility and performance for large datasets but requires React and has a steeper learning curve. datatable is simpler to use and framework-agnostic but may not perform as well with very large datasets. The choice between them depends on project requirements, existing tech stack, and dataset size.
A lightning fast JavaScript grid/spreadsheet
Pros of SlickGrid
- More mature and battle-tested, with a longer history of development and use in production environments
- Offers advanced features like frozen columns, grouping, and custom editors out of the box
- Highly performant, capable of handling millions of rows with smooth scrolling
Cons of SlickGrid
- Less modern codebase, primarily using jQuery, which may not align with current development trends
- Steeper learning curve due to its extensive feature set and configuration options
- Less active development and community support in recent years
Code Comparison
SlickGrid:
var grid = new Slick.Grid("#myGrid", data, columns, options);
grid.onCellChange.subscribe(function (e, args) {
console.log("Cell changed: ", args);
});
Datatable:
const datatable = new DataTable('#myTable', {
columns: columns,
data: data
});
datatable.on('cellChange', (cell) => {
console.log("Cell changed: ", cell);
});
Both libraries offer similar functionality for creating data grids, but SlickGrid provides more advanced features at the cost of complexity, while Datatable focuses on simplicity and modern web development practices. SlickGrid may be better suited for large-scale, data-intensive applications, while Datatable could be preferable for simpler use cases or projects prioritizing a modern tech stack.
Build interactive dashboards in minutes.
Pros of Gridstack.js
- More flexible layout options with drag-and-drop functionality
- Better suited for creating dynamic, resizable grid layouts
- Supports responsive design with mobile-friendly features
Cons of Gridstack.js
- Steeper learning curve due to more complex API
- Heavier in terms of file size and performance impact
- Less focused on data presentation compared to Datatable
Code Comparison
Gridstack.js:
<div class="grid-stack">
<div class="grid-stack-item" data-gs-x="0" data-gs-y="0" data-gs-width="4" data-gs-height="2">
<div class="grid-stack-item-content">Item 1</div>
</div>
<div class="grid-stack-item" data-gs-x="4" data-gs-y="0" data-gs-width="4" data-gs-height="4">
<div class="grid-stack-item-content">Item 2</div>
</div>
</div>
Datatable:
const datatable = new DataTable('#datatable', {
columns: ['Name', 'Age', 'City'],
data: [
['John Doe', 30, 'New York'],
['Jane Smith', 25, 'London']
]
});
The code comparison shows that Gridstack.js focuses on creating grid layouts with customizable items, while Datatable is designed for displaying tabular data in a more straightforward manner. Gridstack.js requires more markup and configuration for layout, whereas Datatable has a simpler API for data presentation.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Introduction
Frappe DataTable is a simple, modern and interactive datatable library for displaying tabular data. Originally built for ERPNext, it can be used to render large amount of rows without sacrificing performance and has the basic data grid features like inline editing and keyboard navigation. It does not require jQuery, unlike most data grids out there.
Demo
Features
Cell Features
- Custom Formatters
- Inline Editing
- Mouse Selection
- Copy Cells
- Keyboard Navigation
- Custom Cell Editor
Column Features
- Reorder Columns
- Sort by Column
- Remove / Hide Column
- Custom Actions
- Resize Column
- Flexible Layout
Row Features
- Row Selection
- Tree Structured Rows
- Inline Filters
- Large Number of Rows
- Dynamic Row Height
Install
yarn add frappe-datatable
# or
npm install frappe-datatable
Note:
sortablejs
is required to be installed as well.
Usage
const datatable = new DataTable('#datatable', {
columns: [ 'First Name', 'Last Name', 'Position' ],
data: [
[ 'Don', 'Joe', 'Designer' ],
[ 'Mary', 'Jane', 'Software Developer' ]
]
});
Contribution
yarn start
- Start dev server- Open
index.html
located in the root folder, and start development. - Run
yarn lint
before committing changes - This project uses commitizen for conventional commit messages, use
yarn commit
command instead ofgit commit
Read the blog
Making a new datatable for the web
License
Top Related Projects
JavaScript data grid with a spreadsheet look & feel. Works with React, Angular, and Vue. Supported by the Handsontable team ⚡
The best JavaScript Data Table for building Enterprise Applications. Supports React / Angular / Vue / Plain JavaScript.
🤖 Headless UI for building powerful tables & datagrids for TS/JS - React-Table, Vue-Table, Solid-Table, Svelte-Table
React components for efficiently rendering large lists and tabular data
A lightning fast JavaScript grid/spreadsheet
Build interactive dashboards in minutes.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot