Skip to content

Commit

Permalink
fixed string sorter bug, exposed sorters, exposed canvas offset in cell
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Germaneri committed May 18, 2017
1 parent e1e4d5d commit 08e1df2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 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.11.4",
"version": "0.11.5",
"ignore": [
"**/.*",
"node_modules",
Expand Down
18 changes: 10 additions & 8 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1418,8 +1418,8 @@
nodeType: 'canvas-datagrid-cell',
x: cx,
y: cy,
offsetTop: cy,
offsetLeft: cx,
offsetTop: canvasOffsetTop,
offsetLeft: canvasOffsetLeft,
scrollTop: scrollBox.scrollTop,
scrollLeft: scrollBox.scrollLeft,
active: active === true,
Expand Down Expand Up @@ -2185,15 +2185,17 @@
sorters.string = function (columnName, direction) {
var asc = direction === 'asc';
return function (a, b) {
if (a[columnName] === undefined || a[columnName] === null
|| b[columnName] === undefined || b[columnName] === null) {
return false;
if (a[columnName] === undefined || a[columnName] === null) {
return 1;
}
if (b[columnName] === undefined || b[columnName] === null) {
return 0;
}
if (asc) {
if (!a[columnName].localeCompare) { return false; }
if (!a[columnName].localeCompare) { return 1; }
return a[columnName].localeCompare(b[columnName]);
}
if (!b[columnName].localeCompare) { return false; }
if (!b[columnName].localeCompare) { return 1; }
return b[columnName].localeCompare(a[columnName]);
};
};
Expand Down Expand Up @@ -3844,6 +3846,7 @@
intf.dispose = dispose;
intf.appendTo = appendTo;
intf.filters = filters;
intf.sorters = sorters;
intf.autosize = autosize;
intf.beginEditAt = beginEditAt;
intf.endEdit = endEdit;
Expand Down Expand Up @@ -4024,7 +4027,6 @@
intf.attributes = {};
intf.style = {};
intf.formatters = formatters;
intf.filters = filters;
Object.keys(style).forEach(function (key) {
Object.defineProperty(intf.style, key, {
get: function () {
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.11.4",
"version": "0.11.5",
"description": "Canvas based data grid",
"main": "./lib/main.js",
"repository": {
Expand Down

0 comments on commit 08e1df2

Please sign in to comment.