From 594f0df1e8c184a1928230f4a3c2ee088a21b31f Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Mon, 6 Jun 2016 15:34:14 +0300 Subject: [PATCH] Fix cell position editing and diffs --- treegrid.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/treegrid.js b/treegrid.js index 3b8a1d5..7985ab6 100644 --- a/treegrid.js +++ b/treegrid.js @@ -114,7 +114,7 @@ TreeGrid.prototype._setProps = function(el, props) el.innerHTML = props; else for (var j in this.bindProps) - el[j] = props[j] || ''; + el[j] = props[j] !== undefined ? props[j] : ''; } // Simple cell editing @@ -378,7 +378,7 @@ function TreeGridNode(node, grid, level, insertBefore, startHidden) var child = new TreeGridNode(node.children[i], grid, this.level+1, insertBefore, this.collapsed); child._index = i; this.children.push(child); - if (child.key) + if (child.key !== undefined) this.childrenByKey[child.key] = child; } } @@ -608,7 +608,7 @@ TreeGridNode.prototype.removeChild = function(nodeOrIndex) return false; var e = this.children[nodeOrIndex].tr; var l = this.children[nodeOrIndex].level; - if (this.children[nodeOrIndex].key) + if (this.children[nodeOrIndex].key !== undefined) delete this.childrenByKey[this.children[nodeOrIndex].key]; this.children.splice(nodeOrIndex, 1); for (var i = nodeOrIndex; i < this.children.length; i++) @@ -644,7 +644,7 @@ TreeGridNode.prototype.addChildren = function(nodes, insertBefore) var child = new TreeGridNode(nodes[i], this.grid, this.level+1, e, this.collapsed); child._index = insertBefore+i; this.children.splice(insertBefore+i, 0, child); - if (child.key) + if (child.key !== undefined) this.childrenByKey[child.key] = child; } for (var i = insertBefore+nodes.length; i < this.children.length; i++)