Mangalaputta / dynatree

Automatically exported from code.google.com/p/dynatree
0 stars 0 forks source link

Add multiple actions to node title #426

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

I am not sure if this is requested before or not.
I am trying to add a clickable image next to the title in a node.
Clicking on node title will have different action than clicking on the image.
var node = {
    title:'label' //want to add an image that will have different action than title click
    expand:true,
    icon:false,
    noLink:false,
    children:[],
    };

I am using jquery.dynatree-1.2.4.js on windows 7
What DOCTYPE declaration are you using?html

Currently, i tried to add image by adding a <div><img> tag.  This is giving me 
the image in next line.
Somewhere i read you can add two actions at node title using span tag, but i 
couldn't figure out how to do it.  Can you please suggest?

Thanks

Original issue reported on code.google.com by visa...@gmail.com on 12 May 2013 at 5:47

GoogleCodeExporter commented 8 years ago
I was able to add the image by doing as below.  I found this piece of code on 
discussion boards.  It works.
However, my popup div on click of the image is not positioning at the mouse 
click.  It goes off the page and adds scroll bar.  
left:event.pageX,                               
top:event.pageY,
position: "absolute"

any suggestons?

 var postImg = document.createElement('img');
 postImg.setAttribute('src', imagesFolder + "down_arrow.png");
 postImg.setAttribute('id', "image"+node.data.xxxNode.attributes.ID);
 postImg.setAttribute('class', "image_style");                          
 $(span).find('.dynatree-title').after(postImg);

Original comment by visa...@gmail.com on 15 May 2013 at 5:48

GoogleCodeExporter commented 8 years ago
I did the below for positioning and works great
event.target.offsetLeft,
event.target.offsetTop

I add the popup div to dynatree like below
appendTo($("#tree").find("span.dynatree-node"));

Please close the issue

Original comment by visa...@gmail.com on 15 May 2013 at 6:52

GoogleCodeExporter commented 8 years ago
thanks for the feedback

Original comment by moo...@wwwendt.de on 16 May 2013 at 2:54