Bootstrap-Tree icon indicating copy to clipboard operation
Bootstrap-Tree copied to clipboard

Root level [role=leaf] cause a bug

Open zeroasterisk opened this issue 12 years ago • 1 comments

If you load any leaf elements onto the tree which are not contained in a branch it gives an error that the method doesn't exist on undefined... which makes sense

$("body").on("click.tree.data-api", "[role=leaf]", function (e) {
  .........
  e = $.Event("nodeselect", {
    node: $(branch).data("tree").node($this)
  });

I tried hacking in basic support for this, but I couldn't get it right... ideas?

zeroasterisk avatar May 09 '13 14:05 zeroasterisk

+1 for this Actually, it's a problem of single elements (with no parents and children) placed directly in root and their API. I tried both leaf and branch: leaf throws error as mentioned above, branch tries to build children leaf (although it has no children). I have no idea how to solve it at the moment, but I think it must be something about branch = $this.closest(".branch") . Maybe some checks, if there is closest 'branch' - if not, take root element?

alekwisnia avatar Oct 02 '13 11:10 alekwisnia