Skip to content

Commit

Permalink
added data/schema changed events
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Germaneri committed Dec 18, 2016
1 parent 3150608 commit c066bd3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ from appearing for some cells you can subscribe to the `beforebeginedit` event a
when you want the cell to be read only. Using events will give you the most granular control of appearance
and behavior.


selectionchanged
----------------
Fires when the selection changes.
Expand Down Expand Up @@ -676,6 +677,21 @@ scroll
------
Fires when the user scrolls the grid.

datachanged
-----------
Fires when the data setter is set.

| Argument | Description |
|-----|------|
| data | Data. |

schemachanged
-------------
Fires when the schema setter is set.

| Argument | Description |
|-----|------|
| schema | Schema. |

beforerendercell
----------------
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "canvas-datagrid",
"main": "lib/main.js",
"version": "0.9.21",
"version": "0.9.22",
"ignore": [
"**/.*",
"node_modules",
Expand Down
5 changes: 5 additions & 0 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2255,6 +2255,7 @@
});
createNewRowData();
resize();
dispatchEvent('schemachanged', [schema], intf);
}
});
Object.defineProperty(intf, 'data', {
Expand All @@ -2279,6 +2280,9 @@
if (!schema && data.length === 0) {
tempSchema = [{name: ''}];
}
if (tempSchema) {
dispatchEvent('schemachanged', [tempSchema], intf);
}
createNewRowData();
if (attributes.autoResizeColumns && data.length > 0
&& storedSettings === undefined) {
Expand All @@ -2290,6 +2294,7 @@
});
setScrollArea();
if (!resize()) { draw(); }
dispatchEvent('datachanged', [data], intf);
}
});
if (attributes.name && attributes.saveAppearance) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "canvas-datagrid",
"version": "0.9.21",
"version": "0.9.22",
"description": "Canvas based data grid",
"main": "./lib/main.js",
"scripts": {
Expand Down

0 comments on commit c066bd3

Please sign in to comment.