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

How to check whether the selected TextNode is the root node

Expand Messages
  • rumesh_san
    Hi, I m a newbie to yui. So could anyone help me to check whether the selected TextNode is the root node. I m referring this to the context menu based
    Message 1 of 4 , May 27, 2009
      Hi,

      I'm a newbie to yui. So could anyone help me to check whether the selected TextNode is the root node. I'm referring this to the context menu based TreeView.

      Thanks in advance

      Regards,
      Rumesh
    • Flinn2112
      ... Hi Rumesh, hope I did not misunderstand your question. Do a getRoot ( ) on the treeview (i.e. NS2112.REPOSITORY.m_RepositoryTree.getRoot()) which will
      Message 2 of 4 , May 27, 2009
        --- In ydn-javascript@yahoogroups.com, "rumesh_san" <rumesh_san@...> wrote:
        >
        > Hi,
        >
        > I'm a newbie to yui. So could anyone help me to check whether the selected TextNode is the root node. I'm referring this to the context menu based TreeView.
        >
        > Thanks in advance
        >
        > Regards,
        > Rumesh
        >
        Hi Rumesh,
        hope I did not misunderstand your question.
        Do a getRoot ( ) on the treeview (i.e. NS2112.REPOSITORY.m_RepositoryTree.getRoot())
        which will give you a NODE back.
        and compare the properties for the node that was clicked with the returned node.

        Kind Regards

        Frank
      • Satyam
        If the parent property of a node is null, it s the root. So, if (YAHOO.lang.isNull(myNode.parent)) then that s the root. TreeView has a getRoot method. All
        Message 3 of 4 , May 27, 2009
          If the parent property of a node is null, it's the root. So, if
          (YAHOO.lang.isNull(myNode.parent)) then that's the root.

          TreeView has a getRoot method. All nodes have a tree property so
          myNode.tree.getRoot() gives you the root

          if (myNode.tree.getRoot() === myNode) then myNode is the root.

          This was a triple equal comparison.

          if the node is an instance of RootNode, then it is a root.

          Finally, if the isRoot method returns true, I believe you can trust it.

          Satyam


          rumesh_san escribió:
          > Hi,
          >
          > I'm a newbie to yui. So could anyone help me to check whether the selected TextNode is the root node. I'm referring this to the context menu based TreeView.
          >
          > Thanks in advance
          >
          > Regards,
          > Rumesh
          >
          >
          >
          > ------------------------------------
          >
          > Yahoo! Groups Links
          >
          >
          >
          > ------------------------------------------------------------------------
          >
          >
          > No virus found in this incoming message.
          > Checked by AVG - www.avg.com
          > Version: 8.5.339 / Virus Database: 270.12.41/2136 - Release Date: 05/26/09 20:20:00
          >
          >
        • rumesh_san
          Thank you guys, It is working :)
          Message 4 of 4 , May 31, 2009
            Thank you guys, It is working :)
          Your message has been successfully submitted and would be delivered to recipients shortly.