jquery-treetable icon indicating copy to clipboard operation
jquery-treetable copied to clipboard

Method 'expandNode' doesn't expand when treetable is not visible

Open ivangfr opened this issue 11 years ago • 1 comments

Hi,

I am using jquery-treetable together with JQueryUI tabs. Each tab has its on treetable. After the initialization of the treetables, I call 'expandNode' on a specific node. The treetable that is in the active (and visible) tab expands successfully. However, the other treetables (that are in the hidden tabs) remains collapsed, even though the icon changes to 'expanded'.

For while, I changed this method, commenting the 'if' as shown bellow:

    Node.prototype.expand = function() {
      if (this.expanded()) {
        return this;
      }

      this.row.removeClass("collapsed").addClass("expanded");

      if (this.initialized && this.settings.onNodeExpand != null) {
        this.settings.onNodeExpand.apply(this);
      }

      //if ($(this.row).is(":visible")) { //commented
        this._showChildren();
      //}

      this.expander.attr("title", this.settings.stringCollapse);

      return this;
    };

Now it works! Why the condition that I commented is necessary?

Thanks!

ivangfr avatar Mar 30 '15 14:03 ivangfr

Hi, If you call table.treetable('expandNode', nodeId); on a node under a collapsed node you will need the condition ($(this.row).is(":visible")). To solve the problem (Method 'expandNode' doesn't expand when treetable is not visible), I replaced the condition ($(this.row).is(':visible')) by ($(this.row).css("display") != "none")

zakariamoulou avatar Apr 25 '18 23:04 zakariamoulou