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

How do I remove a node from the treeview?

Expand Messages
  • Rich
    I am trying to remove a node from the treeview using the following code. nodeToRemove = tree.getNodeByIndex(nodeToRemoveIndex); tree.removeNode(nodeToRemove);
    Message 1 of 3 , Mar 28, 2008
    • 0 Attachment
      I am trying to remove a node from the treeview using the following code.

      nodeToRemove = tree.getNodeByIndex(nodeToRemoveIndex);
      tree.removeNode(nodeToRemove);

      However, I get the following error when tree.removeNode is executed.

      Error: 'this.tree.root' is null or not an object.

      Can anyone tell me how to correct this problem?
    • Adam Moore
      ... getNodeByIndex will return null if it doesn t find a node with the supplied index. Verify you are providing a valid index. If that doesn t help you solve
      Message 2 of 3 , Mar 31, 2008
      • 0 Attachment
        On Fri, Mar 28, 2008 at 11:28:47PM -0000, Rich wrote:
        > I am trying to remove a node from the treeview using the following code.
        >
        > nodeToRemove = tree.getNodeByIndex(nodeToRemoveIndex);
        > tree.removeNode(nodeToRemove);
        >
        > However, I get the following error when tree.removeNode is executed.
        >
        > Error: 'this.tree.root' is null or not an object.
        >
        > Can anyone tell me how to correct this problem?

        getNodeByIndex will return null if it doesn't find a node with the
        supplied index. Verify you are providing a valid index. If that
        doesn't help you solve the problem, please post a link to your code.

        -Adam
      • rich_71121
        Thanks. I ll give it a try and let you know if it works. ... getNodeByIndex will return null if it doesn t find a node with the supplied index. Verify you are
        Message 3 of 3 , Apr 1, 2008
        • 0 Attachment
          Thanks.  I'll give it a try and let you know if it works.

          Adam Moore <adamoore@...> wrote:
          On Fri, Mar 28, 2008 at 11:28:47PM -0000, Rich wrote:
          > I am trying to remove a node from the treeview using the following code.
          >
          > nodeToRemove = tree.getNodeByIndex(nodeToRemoveIndex);
          > tree.removeNode(nodeToRemove);
          >
          > However, I get the following error when tree.removeNode is executed.
          >
          > Error: 'this.tree.root' is null or not an object.
          >
          > Can anyone tell me how to correct this problem?

          getNodeByIndex will return null if it doesn't find a node with the
          supplied index. Verify you are providing a valid index. If that
          doesn't help you solve the problem, please post a link to your code.

          -Adam


          You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.

        Your message has been successfully submitted and would be delivered to recipients shortly.