Skip to content

Commit

Permalink
fixed bug where zero rows caused a benign error. Fixed last header ce…
Browse files Browse the repository at this point in the history
…ll graphical problem.
  • Loading branch information
Tony Germaneri committed Jan 17, 2017
1 parent c68b3f8 commit 4ffd635
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
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.24",
"version": "0.9.26",
"ignore": [
"**/.*",
"node_modules",
Expand Down
23 changes: 19 additions & 4 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -906,10 +906,23 @@
d[uniqueId] = header[uniqueId];
drawCell(headerCell, -1)(d, index);
});
// fill in the space right of the headers
if (x < w) {
c = {
name: '',
width: w - x,
style: 'headerCell',
type: 'string',
index: s.length
};
c[uniqueId] = 'headerCell';
drawCell({endCap: ''}, -1)(c, -1);
}
// fill in the space left of the headers
if (attributes.showRowHeaders) {
x = parentNode.offsetLeft;
cornerCell = {'cornerCell': '' };
cornerCell[uniqueId] = 'cornerCell';
x = parentNode.offsetLeft;
c = {
name: 'cornerCell',
width: style.headerRowWidth,
Expand Down Expand Up @@ -1111,9 +1124,11 @@
+ cellBorder;
scrollIndexTop += 1;
}
scrollIndexTop = Math.max(scrollIndexTop - 1, 0);
scrollPixelTop = Math.max(scrollPixelTop
- (sizes.rows[data[scrollIndexTop][uniqueId]] || style.cellHeight), 0);
if (data.length > 0) {
scrollIndexTop = Math.max(scrollIndexTop - 1, 0);
scrollPixelTop = Math.max(scrollPixelTop
- (sizes.rows[data[scrollIndexTop][uniqueId]] || style.cellHeight), 0);
}
ellipsisCache = {};
draw(true);
if (input) {
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.25",
"version": "0.9.26",
"description": "Canvas based data grid",
"main": "./lib/main.js",
"scripts": {
Expand Down

0 comments on commit 4ffd635

Please sign in to comment.