PDA

View Full Version : DOJO help


javaguy1007
04-18-2009, 11:44 PM
Hi Frnds

I am new to dojo. I am trying to implement multiple selection of dojo tree nodes and copy them to anothe list box. Can u help me how to implement this

jsp code

<button dojoType="button" onClick="remove_elem(document.getElementById('myname').selectedIndex);" > < </button>
</td>
<td>
<button dojoType="button" onClick="myfunction();" > > </button>
</td>
<td>
<select name="myname" id="myname" multiple="multiple" style="height: 200px; width: 240px; overflow: auto">

</select>


jscode


function myfunction()
{
var node = dojo.widget.byId('tree').selectedNode;
var strText = node.title;
var fullpath;
if(node.parent.title == "Rootnode"){
fullpath = node.title;
}
else if (node.parent.parent.title == "Rootnode")
{
fullpath = node.parent.title+"//"+node.title;
} else if (node.parent.parent.title == "Rootnode")
{
fullpath = node.parent.title + "//" + node.parent.title + "//" + node.title;
} else if (node.parent.parent.parent.title == "Rootnode")
{
fullpath = node.parent.parent.title + "//" + node.parent.title + "//" + node.title;
}else if (node.parent.parent.parent.parent.title == "Rootnode")
{
fullpath = node.parent.parent.parent.title + "//" + node.parent.parent.title + "//" + node.parent.title + "//" + node.title;
}else if (node.parent.parent.parent.parent.parent.title == "Rootnode")
{
fullpath = node.parent.parent.parent.parent.title + "//" + node.parent.parent.parent.title + "//" + node.parent.parent.title + "//" + node.parent.title + "//" + node.title;
}
var len = document.getElementById('myname').length;

if (node){

document.getElementById('myname').options[len] = new Option(strText,fullpath);

}else{ alert(" Please Select the node"); }
}