$("tree").jstree('create_node', '#', {'id' : 'newId', 'text' : 'new Name'}, 'last');
"contextmenu": {
"select_node": true,
"items": function(node) {
var obj = {
"add_folder": {
"label": "Add Folder",
"action": function(args) {
//var sel = $("#jstree_demo").jstree('create_node', '#', {'id' : 'new Id', 'text' : 'new Name'}, 'last');
//var sel = $("#jstree_demo").jstree('create_node', '#', { 'attr' : { 'id' : "newId" } , 'text' : "newName"}, 'last');
//var sel = $("#jstree_demo").jstree(true).create_node('#', { 'attr' : { 'id' : "newId" } , 'text' : "newName"}, 'last');
var sel = $("#jstree_demo").jstree(true).create_node("#", {
"text": "New Folder",
"type": "root"
}, "first", null, false);
console.log(sel);
}
}
};
return obj;
}
}
var instance = $("#tree").jstree(true);Ivan, what do you think of jstree recognizing null as indicating the new node should appear at the top level? Would you add that feature?
--
You received this message because you are subscribed to a topic in the Google Groups "jsTree" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jstree/TXaRM8BXw0c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jstree+un...@googlegroups.com.
To post to this group, send email to jst...@googlegroups.com.
Visit this group at http://groups.google.com/group/jstree.
For more options, visit https://groups.google.com/d/optout.
The null change is in the repo and I added a comment in the api documentation about creating root nodes (it will be on jstree.com when I release the next version).
--

I want it to, regardless if a node is slected or not...to create a root node. The odd thing is that at one point...doing as I copied actually worked...then it stopped working and I don't know why.So if I have the followingRoot1sub item1sub item 2sub sub item 1sub item 3Root2If I either have nothing selected or any of the above selected, it would create a root node at the level of Root 1 and Root 2...just to make sure we are on the same sheet of music :-D Thanks for your help! This is the last item I need help with to get my page working. It's a pretty cool setup you have.Eric RobertsSr. ColdFusion DeveloperNRG EnergyI do have a question not related to this...why not have the plugin files in SRC define the plugins, instead of having all of the code in jstree.js...making them true plugins? It would push more to the OOP model that jquery makes use of and it would make debugging some of the code a bit easier. I am not fan of having to go through thousands of lines of code...I like the OOP model where it is broken down into separate files. I just find it easier to deal with.
To unsubscribe from this group and all its topics, send an email to jstree+unsubscribe@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to jstree+un...@googlegroups.com.