MCPcopy Index your code
hub / github.com/TonyGermaneri/canvas-datagrid

github.com/TonyGermaneri/canvas-datagrid @v0.25.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.25.4 ↗ · + Follow
196 symbols 450 edges 30 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

canvas-datagrid

Demo - City of Chicago government employee list. Thanks to data.gov.

canvas-datagrid

NPM License Published on webcomponents.org

  • Works with Firefox, IE11, Edge, Safari and Chrome.
  • Native support for touch devices (phones and tablets).
  • Rich documentation, tutorials, and slack support.
  • Single canvas element, drawn in immediate mode, data size does not impact performance.
  • Support for unlimited rows and columns without paging or loading.
  • Rich API of events, methods and properties using the familiar W3C DOM interface.
  • Extensible styling, filtering, formatting, resizing, selecting, and ordering.
  • Support for hierarchal drill in style row level inner grids as well grids in cells.
  • Customizable hierarchal context menu.
  • Built in and custom styles.
  • W3C Web Component. Works in all frameworks.
  • Per-user styles, column sizes, row sizes, view preferences and settings using localStorage.
  • Small file size

Documentation

Tutorials

Slack Support (message author for invite)

Style Builder

Download latest version (minified)

Tests

Source Code

Latest Test Coverage

Installation

With npm

npm install canvas-datagrid

Place the single source file ./dist/canvas-datagrid.js in your web page using a script tag that points to the source or use webpack.

<script src="https://github.com/TonyGermaneri/canvas-datagrid/raw/v0.25.4/dist/canvas-datagrid.js"></script>

Alternatively, instead of downloading and installing, you can link directly to an NPM CDN like unpkg.com.

<script src="https://unpkg.com/canvas-datagrid"></script>

A function will be added to the global scope of the web page called canvasDatagrid as well as module loader definitions.

Getting started

Works with webpack, without webpack or as a web component. No matter how you load it, canvasDatagrid is declared in the global scope.

Canvas-datagrid is a Web Component when in a compatible browser, otherwise it is a <canvas> tag.

Using pure JavaScript

var grid = canvasDatagrid();
document.body.appendChild(grid);
grid.data = [
    {col1: 'row 1 column 1', col2: 'row 1 column 2', col3: 'row 1 column 3'},
    {col1: 'row 2 column 1', col2: 'row 2 column 2', col3: 'row 2 column 3'}
];

Using Web Component

<canvas-datagrid class="myGridStyle" data="data can go here too">[
    {"col1": "row 1 column 1", "col2": "row 1 column 2", "col3": "row 1 column 3"},
    {"col1": "row 2 column 1", "col2": "row 2 column 2", "col3": "row 2 column 3"}
]</canvas-datagrid>

or

var grid = document.createElement('canvas-datagrid');
grid.data = [
    {"col1": "row 1 column 1", "col2": "row 1 column 2", "col3": "row 1 column 3"},
    {"col1": "row 2 column 1", "col2": "row 2 column 2", "col3": "row 2 column 3"}
];

Using Vue

<canvas-datagrid :data.prop="[{"col1": "row 1 column 1"}]"></canvas-datagrid>

More Demos

Note about XHR paging demo: Thanks to jservice for the use of the free paging API. You must "load unsafe scripts" or relevant command to allow HTTPS (github) to make XHR requests to HTTP (Jeopardy Questions API). There is nothing unsafe about this.

Building & Testing

To install development dependencies. Required to build or test.

npm install

To build production and debug versions.

npm run build

To build documentation.

npm run build-docs

To run tests. Note: Headless tests will mostly fail due to lack of headless canvas pixel detection support. Use VM testing or your browser.

npm test

Core symbols most depended-on inside this repo

g
called by 183
test/tests.js
assertIf
called by 159
test/tests.js
smallData
called by 91
test/tests.js
assertPxColor
called by 61
test/tests.js
mousemove
called by 59
test/tests.js
canvasDatagrid
called by 53
lib/main.js
ce
called by 46
tutorials/js/main.js
mouseup
called by 28
test/tests.js

Shape

Function 182
Method 10
Class 4

Languages

TypeScript100%

Modules by API surface

lib/draw.js44 symbols
test/tests.js26 symbols
tutorials/styleBuilder.js23 symbols
lib/contextMenu.js20 symbols
tutorials/js/main.js16 symbols
tutorials/reactExample.js15 symbols
lib/events.js11 symbols
tutorials/tutorials.js6 symbols
tutorials/sparklineDemo.js5 symbols
tutorials/demo.js5 symbols
lib/publicMethods.js5 symbols
tutorials/xhrPagingDemo.js4 symbols

For agents

$ claude mcp add canvas-datagrid \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page