Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@glideapps/glide-data-grid

Package Overview
Dependencies
Maintainers
8
Versions
294
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glideapps/glide-data-grid

Super fast, pure canvas Data Grid Editor

  • 3.5.0-alpha2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
35K
increased by11.66%
Maintainers
8
Weekly downloads
 
Created
Source


Glide Data Grid

A relatively small HTML5 Canvas based data editor supporting millions of rows, rapid updating, and fully native scrolling. We built Data Grid as the basis for the Glide Data Editor.

Version React 16+ Code Coverage Bundle Size License MIT Made By Glide

Data Grid

👩‍💻 Demo and features

Lot's of fun examples are in our Storybook

Features

  • It scales to millions of rows. Cells are rendered lazily on demand for memory efficiency.
  • Scrolling is extremely fast. Native scrolling keeps everything buttery smooth.
  • Supports multiple types of cells. Numbers, text, markdown, bubble, image, drilldown, uri
  • Fully Free & Open Source. MIT licensed so you can use Grid in commerical projects.
  • Editing is built in.
  • Resizable and movable columns.
  • Variable sized rows.
  • Merged cells.
  • Single and multi-select rows, cells, and columns.
  • Cell rendering can be fully customized.

⚡ Quick Start

First make sure you are using React 16 or greater. Then install the data grid:

npm i @glideapps/glide-data-grid

You may also need to install the peer dependencies if you don't have them already:

npm i lodash marked react-responsive-carousel styled-components

Create a new DataEditor wherever you need to display lots and lots of data

// The container is not required, but is convenient for getting started
<DataEditorContainer width={1000} height={700}>
    <DataEditor getCellContent={getData} columns={columns} rows={numRows} />
</DataEditorContainer>

Making your columns is easy

// Grid columns may also provide icon, overlayIcon, menu, style, and theme overrides
const columns: GridColumn[] = [
    { title: "First Name", width: 100 },
    { title: "Last Name", width: 100 },
];

Last provide data to the grid

// If fetching data is slow you can use the DataEditor ref to send updates for cells
// once data is loaded.
function getData([col, row]: readonly [number, number]): GridCell {
    const person = getData(row);

    if (col === 0) {
        return {
            kind: GridCellKind.Text,
            data: person.firstName,
            allowOverlay: false,
        };
    } else if (col === 1) {
        return {
            kind: GridCellKind.Text,
            data: person.lastName,
            allowOverlay: false,
        };
    } else {
        throw new Error();
    }
}

Full API documentation

The full API documentation is in the API.md file.

📒 FAQ

Nothing shows up!

Please read the Prerequisites section in the docs.

It crashes when I try to edit a cell!

Please read the Prerequisites section in the docs.

Does it work with screen readers and other a11y tools?

Yes. Unfortunately none of the primary developers are accessibility users so there are likely flaws in the implementation we are not aware of. Bug reports welcome!

Does it support my data source?

Yes.

Data Grid is agnostic about the way you load/store/generate/mutate your data. What it requires is that you tell it which columns you have, how many rows, and to give it a function it can call to get the data for a cell in a specific row and column.

Does it do sorting, searching, and filtering?

Search is included. You provide the trigger, we do the search. Example in our storybook.

Filtering and sorting are something you would have to implement with your data source. There are hooks for adding column header menus if you want that.

The reason we don't add filtering/sorting in by default is that these are usually very application-specific, and can often also be implemented more efficiently in the data source, via a database query, for example.

Can it do frozen columns?

Yes!

Can I render my own cells?

Yes, but the renderer has to use HTML Canvas. Simple example in our Storybook.

Why does Data Grid use HTML Canvas?

Originally we had implemented our Grid using virtualized rendering. We virtualized both in the horizontal and vertical direction using react-virtualized. The problem is simply scrolling performance. Once you need to load/unload hundreds of DOM elements per frame nothing can save you.

There are some hacks you can do like setting timers and entering into a "low fidelity" rendering mode where you only render a single element per cell. This works okay until you want to show hundreds of cells and you are right back to choppy scrolling. It also doesn't really look or feel great.

Keywords

FAQs

Package last updated on 17 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc