Convert Figma logo to code with AI

future-architect logocheetah-grid

The fastest open-source data table for web.

1,459
118
1,459
37

Top Related Projects

13,037

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

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

React components for efficiently rendering large lists and tabular data

25,067

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

Quick Overview

Cheetah Grid is a high-performance JavaScript data grid library for web applications. It offers fast rendering and scrolling capabilities, making it suitable for handling large datasets in a responsive manner. The library is designed to be lightweight and easy to integrate into various web frameworks.

Pros

  • Exceptional performance for large datasets
  • Smooth scrolling and rendering capabilities
  • Customizable appearance and behavior
  • Supports various data types and formatting options

Cons

  • Limited built-in features compared to some other grid libraries
  • Learning curve for advanced customizations
  • Documentation could be more comprehensive
  • Smaller community compared to more established grid libraries

Code Examples

  1. Basic grid initialization:
import { ListGrid } from 'cheetah-grid'

const grid = new ListGrid({
  parentElement: document.getElementById('grid-container'),
  header: [
    { field: 'id', caption: 'ID' },
    { field: 'name', caption: 'Name' },
    { field: 'age', caption: 'Age' }
  ],
  records: [
    { id: 1, name: 'John Doe', age: 30 },
    { id: 2, name: 'Jane Smith', age: 25 },
    { id: 3, name: 'Bob Johnson', age: 35 }
  ]
})
  1. Adding custom column styles:
const grid = new ListGrid({
  // ... other options
  header: [
    { field: 'id', caption: 'ID' },
    { 
      field: 'name', 
      caption: 'Name',
      style: {
        textAlign: 'center',
        color: 'blue'
      }
    },
    { field: 'age', caption: 'Age' }
  ]
})
  1. Implementing a custom cell renderer:
const grid = new ListGrid({
  // ... other options
  header: [
    { field: 'id', caption: 'ID' },
    { field: 'name', caption: 'Name' },
    { 
      field: 'status', 
      caption: 'Status',
      columnType: new cheetahGrid.columns.type.ButtonColumn({
        caption: 'Toggle',
        onClick: (rec) => {
          rec.status = rec.status === 'Active' ? 'Inactive' : 'Active'
          grid.invalidateCell(rec.id, 'status')
        }
      })
    }
  ]
})

Getting Started

  1. Install Cheetah Grid:
npm install cheetah-grid
  1. Import and use in your project:
import { ListGrid } from 'cheetah-grid'

const grid = new ListGrid({
  parentElement: document.getElementById('grid-container'),
  header: [
    { field: 'id', caption: 'ID' },
    { field: 'name', caption: 'Name' }
  ],
  records: [
    { id: 1, name: 'John Doe' },
    { id: 2, name: 'Jane Smith' }
  ]
})
  1. Include the CSS file in your HTML:
<link rel="stylesheet" href="node_modules/cheetah-grid/dist/cheetahGrid.css">

Competitor Comparisons

13,037

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

Pros of ag-grid

  • More comprehensive feature set, including advanced filtering, sorting, and grouping
  • Extensive documentation and community support
  • Enterprise version available with additional features

Cons of ag-grid

  • Steeper learning curve due to its complexity
  • Larger file size and potential performance impact for simpler use cases

Code Comparison

ag-grid:

const gridOptions = {
  columnDefs: [
    { field: 'name' },
    { field: 'age', filter: 'agNumberColumnFilter' }
  ],
  rowData: [
    { name: 'John', age: 35 },
    { name: 'Alice', age: 28 }
  ]
};

Cheetah Grid:

const grid = new Cheetah.ListGrid({
  parentElement: document.getElementById('grid'),
  header: [
    { field: 'name', caption: 'Name' },
    { field: 'age', caption: 'Age' }
  ],
  records: [
    { name: 'John', age: 35 },
    { name: 'Alice', age: 28 }
  ]
});

Both libraries offer data grid functionality, but ag-grid provides more built-in features and customization options, while Cheetah Grid focuses on simplicity and performance. The code examples demonstrate that ag-grid requires more configuration, whereas Cheetah Grid has a more straightforward setup process.

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 built-in functionalities like sorting, filtering, and validation
  • Extensive documentation and community support
  • Offers both open-source and commercial versions with additional features

Cons of Handsontable

  • Heavier and potentially slower for large datasets compared to Cheetah Grid
  • Steeper learning curve due to its extensive API and configuration options
  • Commercial license required for some advanced features and use cases

Code Comparison

Handsontable:

const hot = new Handsontable(container, {
  data: dataset,
  columns: [
    { type: 'text', data: 'name' },
    { type: 'numeric', data: 'age' }
  ],
  rowHeaders: true,
  colHeaders: true
});

Cheetah Grid:

const grid = new cheetahGrid.ListGrid({
  parentElement: document.getElementById('grid'),
  header: [
    {field: 'name', caption: 'Name'},
    {field: 'age', caption: 'Age', type: 'number'}
  ],
  records: dataset
});

Both libraries offer powerful data grid solutions, but Handsontable provides more out-of-the-box features at the cost of increased complexity and potential performance overhead. Cheetah Grid focuses on simplicity and performance, making it suitable for large datasets and simpler use cases. The choice between the two depends on specific project requirements and performance considerations.

A lightning fast JavaScript grid/spreadsheet

Pros of SlickGrid

  • More mature and battle-tested, with a larger community and ecosystem
  • Offers advanced features like frozen columns, grouping, and custom editors
  • Highly customizable with extensive plugin support

Cons of SlickGrid

  • Steeper learning curve due to its complexity and extensive API
  • Heavier footprint, which may impact performance for very large datasets
  • Less modern codebase, as it's been around for a longer time

Code Comparison

SlickGrid:

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

Cheetah Grid:

const grid = new cheetahGrid.ListGrid({
  parent: document.getElementById('myGrid'),
  header: columns,
  records: data
});

Both libraries offer powerful grid functionality, but SlickGrid provides more advanced features at the cost of complexity, while Cheetah Grid focuses on simplicity and performance for large datasets. SlickGrid may be better suited for complex enterprise applications, while Cheetah Grid excels in scenarios requiring fast rendering of large amounts of data with a more modern API.

React components for efficiently rendering large lists and tabular data

Pros of react-virtualized

  • More comprehensive set of components for virtualized rendering (List, Grid, Table, etc.)
  • Better integration with React ecosystem and lifecycle methods
  • Extensive documentation and examples

Cons of react-virtualized

  • Steeper learning curve due to more complex API
  • Potentially higher memory usage for large datasets
  • Less performant for extremely large grids (100,000+ cells)

Code Comparison

react-virtualized:

import { List } from 'react-virtualized';

<List
  width={300}
  height={300}
  rowCount={1000}
  rowHeight={20}
  rowRenderer={({ key, index, style }) => (
    <div key={key} style={style}>Row {index}</div>
  )}
/>

Cheetah Grid:

import { ListGrid } from 'cheetah-grid';

new ListGrid({
  parentElement: document.getElementById('grid'),
  header: ['Column 1', 'Column 2'],
  records: [
    { col1: 'Row 1', col2: 'Value 1' },
    { col1: 'Row 2', col2: 'Value 2' }
  ]
});

react-virtualized offers more flexibility for React applications but requires more setup. Cheetah Grid provides a simpler API for basic grid functionality but may be less customizable for complex React-based use cases.

25,067

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

Pros of Table

  • Highly flexible and customizable with a headless UI approach
  • Supports various data sources and integrates well with React, Vue, and Solid
  • Offers advanced features like sorting, filtering, and pagination out of the box

Cons of Table

  • Steeper learning curve due to its headless nature and extensive API
  • May require more setup and configuration for basic use cases
  • Performance might be slower for extremely large datasets compared to Cheetah Grid

Code Comparison

Cheetah Grid:

const grid = new cheetahGrid.ListGrid({
  parent: document.getElementById('grid'),
  header: [
    {field: 'id', caption: 'ID'},
    {field: 'name', caption: 'Name'}
  ],
  records: [
    {id: 1, name: 'John'},
    {id: 2, name: 'Jane'}
  ]
});

Table:

const table = useReactTable({
  data,
  columns,
  getCoreRowModel: getCoreRowModel(),
})

return (
  <table>
    {table.getHeaderGroups().map(headerGroup => (
      // Header rendering
    ))}
    <tbody>
      {table.getRowModel().rows.map(row => (
        // Row rendering
      ))}
    </tbody>
  </table>
)

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

Cheetah Grid

GitHub npm npm npm npm npm Build Status

Cheetah Grid

The fastest open-source data table for web.

capture.png

DEMO & Documents

Downloading Cheetah Grid

Using Cheetah Grid with a CDN

npm

<script src="https://unpkg.com/cheetah-grid@1.15"></script>

Downloading Cheetah Grid using npm

npm

npm install -S cheetah-grid
import * as cheetahGrid from "cheetah-grid";

// or

const cheetahGrid = require("cheetah-grid");

Downloading Cheetah Grid source code

npm

cheetahGrid.es5.min.js

SourceMap
cheetahGrid.es5.min.js.map

Downloading Cheetah Grid using GitHub

GitHub package version

git clone

git clone https://github.com/future-architect/cheetah-grid.git

npm install & build

npm install
npm run build

built file is created in the ./packages/cheetah-grid/dist directory

Usage

Example for basic usage

<div id="sample" style="height: 300px; border: solid 1px #ddd;"></div>
<script>
  // initialize
  const grid = new cheetahGrid.ListGrid({
    // Parent element on which to place the grid
    parentElement: document.querySelector("#sample"),
    // Header definition
    header: [
      {
        field: "check",
        caption: "",
        width: 50,
        columnType: "check",
        action: "check",
      },
      { field: "personid", caption: "ID", width: 100 },
      { field: "fname", caption: "First Name", width: 200 },
      { field: "lname", caption: "Last Name", width: 200 },
      { field: "email", caption: "Email", width: 250 },
    ],
    // Array data to be displayed on the grid
    records,
    // Column fixed position
    frozenColCount: 2,
  });
</script>

Please refer to the documents for details

Using the Vue Component of Cheetah Grid
Please refer to the vue-cheetah-grid

Using the React Component of Cheetah Grid
Please refer to the react-cheetah-grid

Definition of columns and headers

The header property, the property of cheetahGrid.ListGrid, decides the behave and appearance of columns and header cells. We can set this property by constructor arguments or instance property.

The header property must be set by objects array (Array<object>). In the standard definition, each object consists of following properties.

PropertyDescription
captiondefine the header caption
fielddefine the field name or function of the record to display in the cell
width (optional)define the width of column
columnType (optional)define the type of column
style (optional)define the style of column
action (optional)define the action of column

To use multiple header, set the hierarchical structured Object to the header property.

const grid = new cheetahGrid.ListGrid({
  //...
  header: [
    //...
    {
      /* multiple header */
      caption: "Name",
      columns: [
        { field: "fname", caption: "First Name", width: 200 },
        { field: "lname", caption: "Last Name", width: 200 },
      ],
    },
    //...
  ],
  //...
});

Definition of column type

Set the column type by using columnType.

For example, you can set the following strings:

PropertyDescription
nonedraw text in the cell
'number'draw number in the cell with comma-separated
'check'draw checkbox in the cell
'button'draw button in the cell
'image'draw image in the cell
'multilinetext'draw multiline text in the cell

If you define a class instance you can define an advanced column types.

Please refer to the column types documents for details

Definition of column action

Define column action by using action property.

actionDescription
'check'make the check box clickable.
'input'make the cell enterable.

If you define a class instance you can define an advanced column actions.

Please refer to the column actions documents for details

Definition of column style

Define column style by using style property.

Properties below are prepared in standard.

PropertyDescription
colordefine the color of cell.
textAligndefine the horizontal position of text in cell.
textBaselinedefine the vertical position of text in cell.
bgColordefine the background color of cell.
fontdefine the font of cell.
paddingdefine the padding of cell. if you set 4 values separately, please set the Array.
textOverflowdefine how to display when text overflows the area of a cell. clip or ellipsis is available.

In addition, there is an extended style property for each column type.


Please refer to the documents for details

License

See the LICENSE file for license rights and limitations (MIT).

Supporting Cheetah Grid

sponsors

NPM DownloadsLast 30 Days