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

TreeView - Custom style for leafs

Expand Messages
  • matthew_be
    Hi, Whenever I load the data of the nodes,I check if the loaded nodes are leafs. If so, I set the node property isLeaf to true, and I want to apply a custom
    Message 1 of 3 , Sep 1, 2008
    • 0 Attachment
      Hi,

      Whenever I load the data of the nodes,I check if the loaded nodes are
      leafs.

      If so, I set the node property isLeaf to true, and I want to apply a
      custom style on the node's html.

      var tmpNode = new YAHOO.widget.TextNode(myObj, node, false);
      if(arr[2] == 'leaf') {
      tmpNode.isLeaf = true;
      if( document.getElementById(tmpNode.getElId()) )
      alert('node in DOM');
      }

      The problem is that the node doesn't seem to be in the document yet,
      and document.getElementById(tmpNode.getElId()) is false
      Thus I cannot access it to apply a custom style to it.

      Can anyone help ?

      Thank you!
    • Satyam
      The tree is not drawn until you call the draw function. No HTML element is created until then. That s why getElementById can t find it. Satyam
      Message 2 of 3 , Sep 1, 2008
      • 0 Attachment
        The tree is not drawn until you call the draw function. No HTML element
        is created until then. That's why getElementById can't find it.

        Satyam

        matthew_be wrote:
        > Hi,
        >
        > Whenever I load the data of the nodes,I check if the loaded nodes are
        > leafs.
        >
        > If so, I set the node property isLeaf to true, and I want to apply a
        > custom style on the node's html.
        >
        > var tmpNode = new YAHOO.widget.TextNode(myObj, node, false);
        > if(arr[2] == 'leaf') {
        > tmpNode.isLeaf = true;
        > if( document.getElementById(tmpNode.getElId()) )
        > alert('node in DOM');
        > }
        >
        > The problem is that the node doesn't seem to be in the document yet,
        > and document.getElementById(tmpNode.getElId()) is false
        > Thus I cannot access it to apply a custom style to it.
        >
        > Can anyone help ?
        >
        > Thank you!
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
      • matthew_be
        Thank you Stayam for your support ! I hope I don t bother with too many question, I just started with this framework some days ago ! ... element
        Message 3 of 3 , Sep 2, 2008
        • 0 Attachment
          Thank you Stayam for your support !

          I hope I don't bother with too many question,
          I just started with this framework some days ago !


          --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
          >
          > The tree is not drawn until you call the draw function. No HTML
          element
          > is created until then. That's why getElementById can't find it.
          >
          > Satyam
          >
          > matthew_be wrote:
          > > Hi,
          > >
          > > Whenever I load the data of the nodes,I check if the loaded nodes are
          > > leafs.
          > >
          > > If so, I set the node property isLeaf to true, and I want to apply a
          > > custom style on the node's html.
          > >
          > > var tmpNode = new YAHOO.widget.TextNode(myObj, node, false);
          > > if(arr[2] == 'leaf') {
          > > tmpNode.isLeaf = true;
          > > if( document.getElementById(tmpNode.getElId()) )
          > > alert('node in DOM');
          > > }
          > >
          > > The problem is that the node doesn't seem to be in the document yet,
          > > and document.getElementById(tmpNode.getElId()) is false
          > > Thus I cannot access it to apply a custom style to it.
          > >
          > > Can anyone help ?
          > >
          > > Thank you!
          > >
          > >
          > > ------------------------------------
          > >
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.