Skip to content

Commit

Permalink
fixed position bug with context menu, fixed find selection data
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Germaneri committed Nov 30, 2016
1 parent 54187df commit aaadeb6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ define([], function context() {
if (rowIndex === -1 || rowIndex === data.length) { return; }
d[rowIndex] = [];
row.forEach(function (col, colIndex) {
if (colIndex === -1) { return; }
if (col === -1) { return; }
d[rowIndex][col] = data[rowIndex][s[col].name];
});
});
Expand Down Expand Up @@ -602,6 +602,10 @@ define([], function context() {
throw new Error('Cannot sort. No such column name');
}
function localeCompare(a, b) {
if (a[columnName] === undefined || a[columnName] === null
|| b[columnName] === undefined || b[columnName] === null) {
return false;
}
if (asc) {
return a[columnName].localeCompare(b[columnName]);
}
Expand Down Expand Up @@ -776,8 +780,8 @@ define([], function context() {
contextMenu.style.cursor = 'pointer';
contextMenu.style.position = 'absolute';
contextMenu.style.zIndex = '3';
contextMenu.style.top = e.clientY + style.contextMenuMarginTop + 'px';
contextMenu.style.left = e.clientX + style.contextMenuMarginLeft + 'px';
contextMenu.style.top = pos.y + style.contextMenuMarginTop + 'px';
contextMenu.style.left = pos.x + style.contextMenuMarginLeft + 'px';
filterInput.value = filterValue || '';
menuItems = [];
if (attributes.showFilter) {
Expand Down Expand Up @@ -1373,7 +1377,7 @@ define([], function context() {
controlInput.addEventListener('keypress', keypress, false);
controlInput.addEventListener('keyup', keyup, false);
controlInput.addEventListener('keydown', keydown, false);
container.addEventListener('mouseup', mouseup, false);
document.body.addEventListener('mouseup', mouseup, false);
container.addEventListener('mousedown', mousedown, false);
container.addEventListener('dblclick', dblclick, false);
container.addEventListener('click', click, false);
Expand Down Expand Up @@ -1591,4 +1595,4 @@ define([], function context() {
return intf;
}
return grid;
});
});
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.0",
"version": "0.9.1",
"description": "Canvas based data grid",
"main": "./lib/main.js",
"scripts": {
Expand Down

0 comments on commit aaadeb6

Please sign in to comment.