Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@glideapps/glide-data-grid
Advanced tools
We built Data Grid as the basis for the Glide Data Editor. It's a React component built on top of HTML Canvas.
To add Grid to your own project:
$ npm install @glideapps/glide-data-grid
# Install peer dependencies
$ npm install direction marked react-responsive-carousel styled-components
First you need to define your columns:
const columns: GridColumn[] = [
{ title: "Number", width: 100 },
{ title: "Square", width: 100 },
];
Next you need a function which, given column and row indexes, returns a cell to display. Here we have two columns, the first of which shows the index of the row, and the second the square of that number:
function getData([col, row]: readonly [number, number]): GridCell {
let n: number;
if (col === 0) {
n = row;
} else if (col === 1) {
n = row * row;
} else {
throw new Error("This should not happen");
}
return {
kind: GridCellKind.Number,
data: n,
displayData: n.toString(),
allowOverlay: false,
};
}
Now you can use Data Grid:
<DataEditorContainer width={500} height={300}>
<DataEditor getCellContent={getData} columns={columns} rows={1000} />
</DataEditorContainer>
The full API documentation is in the API.md
file.
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?
Not yet unfortunately. This is on our todo list.
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.
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 rows/columns?
Not yet, but there is some infrastructure for this internally already, and we accept PRs.
Can I render my own cells?
Yes, but the renderer has to use HTML Canvas.
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.
FAQs
React data grid for beautifully displaying and editing large amounts of data with amazing performance.
The npm package @glideapps/glide-data-grid receives a total of 17,405 weekly downloads. As such, @glideapps/glide-data-grid popularity was classified as popular.
We found that @glideapps/glide-data-grid demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.