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

Custom event for treeview HTMLNode

Expand Messages
  • Peter Pistorius
    How do I use the YUI event util to add a custom click event to a HTMLNode... This is how I create the node: var html = +
    Message 1 of 3 , May 4, 2006
    • 0 Attachment
      How do I use the YUI event util to add a custom 'click' event to a
      HTMLNode...


      This is how I create the node:

      var html = '<div>'
      + '<img src="path/to/file" /> <br />'
      + 'label'
      + '</div>';

      var tmpNode = new YAHOO.widget.HTMLNode(html, node, false);


      I was thinking of using tmpNode.getEl() or tmpNode.getElId(), but adding
      an event using addListener doesn't seem to work ... No event is fired.

      Am I missing something here?

      Kind regards,
      Peter Pistorius
    • Philip Tellis
      ... html is not a node, it s a string. To create a node, do this: var html = document.createElement( div ); ... -- Gosh that takes me back... or is it
      Message 2 of 3 , May 4, 2006
      • 0 Attachment
        Sometime Today, PP cobbled together some glyphs to say:

        > This is how I create the node:
        >
        > var html = '<div>'
        > + '<img src="path/to/file" /> <br />'
        > + 'label'
        > + '</div>';

        html is not a node, it's a string. To create a node, do this:
        var html = document.createElement('div');

        >
        > var tmpNode = new YAHOO.widget.HTMLNode(html, node, false);
        >
        >
        > I was thinking of using tmpNode.getEl() or tmpNode.getElId(), but adding
        > an event using addListener doesn't seem to work ... No event is fired.
        >
        > Am I missing something here?
        >
        > Kind regards,
        > Peter Pistorius
        >
        >
        >
        >
        >
        >
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        >

        --
        Gosh that takes me back... or is it forward? That's the trouble with
        time travel, you never can tell."
        -- Doctor Who, "Androids of Tara"


        Journal: http://www.livejournal.com/users/bluesmoon/

        MSN philiptellis Yahoo! philiptellis
        AIM philiptellis
      • idliketointern
        If you do this: var html = document.createElement( div ); Can you assign html variable to label:? For example: var myobj = { label: html, id: myid1 }; var
        Message 3 of 3 , May 23, 2006
        • 0 Attachment
          If you do this:

          var html = document.createElement('div');

          Can you assign html variable to label:?

          For example:
          var myobj = { label: html, id:"myid1" };
          var tmpNode = new YAHOO.widget.TextNode(myobj, root, false);

          I thought it has to be a string, not an object?

          We're having trouble assigning an event to a div inserted into the
          label (obviously, because it's not rendered yet), so a workaround or a
          solution to this would be great.

          Thanks
          Dimitry

          --- In ydn-javascript@yahoogroups.com, Philip Tellis
          <philip.tellis@...> wrote:
          >
          > Sometime Today, PP cobbled together some glyphs to say:
          >
          > > This is how I create the node:
          > >
          > > var html = '<div>'
          > > + '<img src="path/to/file" /> <br />'
          > > + 'label'
          > > + '</div>';
          >
          > html is not a node, it's a string. To create a node, do this:
          > var html = document.createElement('div');
          >
          > >
          > > var tmpNode = new YAHOO.widget.HTMLNode(html, node, false);
          > >
          > >
          > > I was thinking of using tmpNode.getEl() or tmpNode.getElId(), but
          adding
          > > an event using addListener doesn't seem to work ... No event is fired.
          > >
          > > Am I missing something here?
          > >
          > > Kind regards,
          > > Peter Pistorius
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          > >
          > >
          >
          > --
          > Gosh that takes me back... or is it forward? That's the trouble with
          > time travel, you never can tell."
          > -- Doctor Who, "Androids of Tara"
          >
          >
          > Journal: http://www.livejournal.com/users/bluesmoon/
          >
          > MSN philiptellis Yahoo! philiptellis
          > AIM philiptellis
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.