From 2f9ad1c310deb208abb35f235aa22b138615be2a Mon Sep 17 00:00:00 2001 From: Dale Date: Sat, 9 Jun 2018 00:03:06 -0600 Subject: [PATCH] [fix] tree ul/li structure and add css to nicely render tree --- elements/tree-view.html | 114 ++++++++++++++++++++++++++++------------ 1 file changed, 79 insertions(+), 35 deletions(-) diff --git a/elements/tree-view.html b/elements/tree-view.html index 48e5bed..51e8a65 100644 --- a/elements/tree-view.html +++ b/elements/tree-view.html @@ -14,6 +14,11 @@ @@ -81,17 +117,21 @@ ready() { super.ready(); - this.$.tree.addEventListener('click', this.findElement.bind(this)) + this.$.tree.addEventListener('click', this.findElement.bind(this)); } recomputeTree(parent, active) { this.$.tree.innerHTML = ''; + let ul = document.createElement('ul'); + ul.classList.add('tree'); + this.$.tree.appendChild(ul); + // Since we can't add a pojo to each button, generate a new index for // each button in the this.items array of useful data. + this._index = 0; - this.items = this.getChildren(parent, this.$.tree); + this.items = this.getChildren(parent, ul); this.highlight(active); - this.$.tree return this.items; } @@ -109,40 +149,44 @@ return aButton; } - getChildren(parent, div) { - // At every new parent, we create a new