I am currently testing out Dynatree and I just want to ask if there is an available property/parameter in which I can store additional info (like property 'value' in ASP.NET TreeView) for each node? Thanks in advance.
You can add custom properties using HTML with the data attribute (works, although a validator might complain.)
For example add a new url property:
<ul>
<li data="url: 'http://jquery.com'">jQuery home
<li data="url: 'http://docs.jquery.com'">jQuery docs
Or when loading from JSON or JS objects:
children: [
{ title: "jQuery home", url: "http://jquery.com" },
{ title: "jQuery docs", url: "http://docs.jquery.com" },
After that, you can access it like so:
onActivate: function(node) {
if( node.data.url )
window.open(node.data.url);
$("#echoActive").text(node.data.title);
},
EDIT:
Starting with release 1.2 <a>
tags are natively supported ( How to make hyperlinks in dynaTree jQuery plugin clickable? ).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With