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

Re: [ydn-javascript] Hide/Show nodes in a TreeView

Expand Messages
  • Satyam
    Traversing the tree can be done easily, there is a private _nodes array that holds all nodes in a flat array, which means you can go through it unconcerned
    Message 1 of 2 , Aug 30, 2008
    • 0 Attachment
      Traversing the tree can be done easily, there is a private _nodes array
      that holds all nodes in a flat array, which means you can go through it
      unconcerned about how deep they might be. The array is sparse, there
      might be entries set to null, corresponding to deleted nodes.

      The Node.getEl function will provide you with the actual HTML element
      that represents each node and you can hide it by simply setting its
      style to display:none. Hiding a node will hide its children as well.

      There is a problem, however. If you hide the last child in a branch,
      the L shaped icon which renders the tree structure will hide and the
      sideways T of the previous node will have its lower arm ending nowhere.
      You can, however, call getToggleEl on that element and change the
      className from "ygtvtn" to "ygtvln" which would give you the L shaped
      icon. Of course you might as well change the icons showing the tree
      structure so that this would be irrelevant. Anyway, I think that would
      pretty much handle it.

      Satyam


      matthew_be wrote:
      > Hello everyone,
      >
      > I would like to apply a filter on the labels of the nodes in my tree.
      > It would be an input text, and whenever the user start typing letters,
      > it hides the nodes of my TreeView that doesn't start with the
      > specified letters, and when he deletes the letters, the filtered nodes
      > must appear again.
      >
      > I think I'll need to traverse the whole tree's nodes and I need a
      > simple function which hides/shows nodes according their labels,
      > is this possible ?
      >
      > Thank you.
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
      > ------------------------------------------------------------------------
      >
      >
      > No virus found in this incoming message.
      > Checked by AVG - http://www.avg.com
      > Version: 8.0.169 / Virus Database: 270.6.13/1642 - Release Date: 29/08/2008 18:12
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.