JavaScript.CoolDev.Com Support Forums

Any questions related to JavaScript menu and JavaScript tree menu by Javascript.CoolDev.Com

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

User Defined data attached to tree node

 
Post new topic   Reply to topic    JavaScript.CoolDev.Com Forum Index -> COOLjsTree
Author Message
aratatous



Joined: 26 May 2006
Posts: 2

PostPosted: Fri Jul 07, 2006 7:01 pm    Post subject: User Defined data attached to tree node Reply with quote

Can we attach a custom, user defined data to a node in the JSTree control?
If not, can I use node URL and Target for custom use?
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Wed Jul 12, 2006 9:45 am    Post subject: Reply with quote

You can do the following:
Code:
var TREE_NODES = [
    ['Caption', 'http://url/', 'someTargetFrame', {format:{customField1:"something", customField2:123, customField3:[1, 2, 3]}}],
];

And then you can use getFormat() method to get these values:
Code:
var node = tree.nodeByID(...); // or whatever else method to get the reference
alert(node.getFormat().customField1);
alert(node.getFormat().customField2);
alert(node.getFormat().customField3);
Back to top
Display posts from previous:   
Post new topic   Reply to topic    JavaScript.CoolDev.Com Forum Index -> COOLjsTree All times are GMT
Page 1 of 1