Loading ...
Sorry, an error occurred while loading the content.

33430trying again :/ ...null element returned for treeview dynamic nodes

Expand Messages
  • ozgursusoy
    Jun 26, 2008
    • 0 Attachment
      bit disappointed with no responses to this:

      i'm using a treeview where all nodes (except root) are generated by
      dynamic loading. when the user makes additions/modifications/deletions
      to data represented by a node on the treeview, i use
      removeChildren(parentNode) and parentNode.expand() to refresh the
      necessary nodes. once the treeview is refreshed, i need to either
      reselect the original node(when edited), new node(when added) or a
      sibling/parent(when deleted).

      original problem i had was the expandComplete event firing before the
      child nodes are generated, let alone parent node getting expanded.
      easily worked around that by using a custom event fired from the
      function that generates the new nodes.

      however, still having problems with trying to scroll the panel
      containing the treeview to make sure the newly selected node is
      visible on the screen. The problem seems to be in referencing the
      dynamically generated element representing the selected node. both
      getEl() and getLabelEl() are returning null even thought the node has
      an element id!!, below is my handler for the custom event fired once
      nodes are generated:

      var onUpdateNodeLoad = function (type, args){

      _tree.dynamicLoadCompleteEvent.unsubscribe() ;
      nodeToSelect = _tree.getNodeByProperty(keyField, keyToSelect) ;

      //this returns an id, ie.'ygtv15'
      alert("elementID:"+nodeToSelect.getElId( ));

      //this returns null!
      alert("elementFromDoc:"+document.getElementById(nodeToSelect.getElId()));

      //also returns null
      alert("elementFromGetEl: " + nodeToSelect.getEl());

      //so this doesn't work! nodeToSelect.getEl().scrollIntoView() ;
      }


      same results if i use getLabelEl() instead of getEl()!

      i think this might be happening because the parent node still hasn't
      finished expanding when the custom event is fired but how would i get
      around that considering expandComplete is useless in this case?!

      this is getting used for a commercial project so any ideas would be
      much appreciated.
    • Show all 2 messages in this topic