diff --git a/treegrid.js b/treegrid.js index 430e55f..6f8fa11 100644 --- a/treegrid.js +++ b/treegrid.js @@ -1,7 +1,7 @@ /** * Very simple and fast tree grid/table, compatible with dynamic loading and stickyheaders.js * License: MPL 2.0+, (c) Vitaliy Filippov 2016+ - * Version: 2016-10-08 + * Version: 2016-10-24 */ /** @@ -616,7 +616,10 @@ TreeGridNode.prototype.toggle = function() TreeGridNode.prototype.setChildren = function(isLeaf, newChildren) { if (!this.tr) + { + // root node this.grid.tbody.innerHTML = ''; + } else { var tr = this.tr[this.tr.length-1]; @@ -653,7 +656,7 @@ TreeGridNode.prototype.removeChild = function(nodeOrIndex) } if (!this.children[nodeOrIndex]) return false; - var e = this.children[nodeOrIndex].tr; + var e = this.children[nodeOrIndex].tr[0]; var l = this.children[nodeOrIndex].level; if (this.children[nodeOrIndex].key !== undefined) delete this.childrenByKey[this.children[nodeOrIndex].key];