Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by plexofoam on Nov 14, 2008 15:32
open dhtmlx forum
Add a new tree item, rename it and include a url link.

I would like to include a link with a tree item, but also be able to edit the name of the item.

I'm having trouble finding a way to combine clicking on the item to rename it and clicking on the item to follow the link.

It looks like double-clicking to edit and single-clicking to link might work, but I have not fully tested it.

Double-clicking does not seem intuitive. Having a hyperlink next to the item would be better.


The ideal solution would be to include a separate tag for XML or JSON package. For example:

<tree id="0">
    <item id="p1" text="parent item 1" select="1" call="1" url='???'>
</tree>

or any way to get the final output to be:

<span class="standartTreeRow" style="padding-left: 5px; padding-right: 5px;">parent item 1 <a href="source.php?tab=inv&objectid=3633">Edit</a>span>

The experience I am looking for is:

1. Create a NEW ITEM.
2. Rename the NEW ITEM.
3. Click a link to go to the actual page of the NEW ITEM.

Any suggestions would be helpful.
Answer posted by Support on Nov 17, 2008 02:02
In current version of tree, you can have only single text element, which will be fully editable, or fully work as link, it not possible to have only part of it as editable.

>>or any way to get the final output to be:
You can place a custom HTML elements ( link tag in your case) in tree item text, but full text, including inline links will be editable

I think, the best solution in your case - use inline links, and separate editable form attached through onclick event 
<item id="some"><itemtext><![CDATA[ parent item 1 <a href="source.php?tab=inv&objectid=3633">Edit</a>span></itemtext> ]]></item>
...
tree.attachEvent("onClick",function(id){
    //custom edit code
})
Answer posted by plexofoam on Nov 17, 2008 05:59
Excellent!  Thank you.