I’m going to add an “add” button and also try to include “add” in the context menu. What I want to do is provide some sort of Window (I was thinking of overlaying an iFrame) that will allow the user to add nodes ( this will be context sensitive … for example if they click on a Documents node in the tree they will be presented with a window allowing them to upload Word/PDF documents, once they have done this the node will then be added to the tree. So basically I’d like to be able to open up a Window that allows users to enter data and then when they click on OK, it will update the Tree with the new nodes. The reason why I was thinking of using an Iframe is because it will enable me to call different implementations depending on the current node context … i.e. uploading documents, adding user names etc …
Hope all that makes sense.
Regards
Steve
Basically there is no any problem in implementing such functionality.
In your init code you can have something similar to next
aMenu=new dhtmlXContextMenuObject(‘120’,0,“Demo menu”);
function onButtonClick(menuitemId,treeitemId)
{
if (menuitemId==“add”){
window.open(“myform.html”);
window._lastId=treeitemId;
}
}
aMenu.menu.setGfxPath("…/imgs/");
aMenu.menu.loadXML(“menu/_context.xml”);
aMenu.setContextMenuHandler(onButtonClick);
tree=new dhtmlXTreeObject(“treeboxbox_tree”,“100%”,“100%”,0);
tree.enableContextMenu(aMenu);
…
and somewhere in myform.html
function doIt(){
opener.tree.insertNewChild(opener.treeitemId,newId,newName,…);
window.close();
}