The new version is out and available for download at Google Code.
The big news is that I managed to create a few example pages (@jstree.com). I am working on a fully featured example that will combine all the small example pages that are available now – it should be out in a few days.
Please post any bugs you may encounter and don’t forget to request features.
Speaking of features – since the last official download there are some big changes (check out the changelog).
To point out but a few – full multitree support – both trees must have rules.multitree set to true and the receiving tree’s rules are respected; instance manager – a list of trees is maintained and the currently focused one can be reached by tree_component.focusInst().


Thanks for the feedback. jsTree is definitely a great resource!
Did you mean to say that there is no standard method in jsTree for validating against duplicate nodes under a node? I got all excited when I saw the word “now” in your post :)
My function does OK, except that when I test for the duplicate it doesn’t find it, because it is testing against the tree2 JSON that exists before the drop. I can’t seem to access the version of the tree2 JSON that exists after the drop. It doesn’t seem to replace the old tree2 JSON in memory until both beforemove and oncopy have finished.
I noticed that if I drag/drop a 2nd item into tree2 after the dup is dropped, then output the results of tree2.parseJSON(tree2.getJSON());, the dup is then present.
If I could figure out what I’m doing wrong there, I’d be set. Just can’t get to the updated JSON to test for the dup. May just be a result of my less than stellar javascript/jquery skillz :)
Hello,
I use xml_flat async data.
I have some problem when I call a empty Node whis no children.
I send an empty list
whis IE (Chrome to, but beta): endless loop
whis Opéra & Safari: 5-10 sec waiting …
whis FF: OK.
Do you have some fix for this ?
@alain
That indeed was a terrible bug!
I fixed it just now. If you cannot wait for the next official download or download from the SVN – search the source for if(str.length < 10) { and change that “10″ to “15″.
Thank you and sorry for the bug!
P.S – As posted in the notes in the changelog – don’t forget not to pass a parent_id in the XML when using async and xml_flat.
@andy
I am not very sure I understood what you need. Here is a suggestion that will prevent prevent nodes with the same ID’s being in the same folder. Just attach it to the oncopy/onmove callbacks:
function(NODE,REF_NODE,TYPE,TREE_OBJ) {
// REF_NODE will hold the jQuery extended copy of the folder where the node is dropped
REF_NODE = (TYPE != "inside") ? $(REF_NODE).parents("li:eq(0)") : $(REF_NODE);
if(REF_NODE.find("#" + NODE.id.replace("_copy","")).size()) $(NODE).remove();
}
If you need no duplication in the whole tree, use this one:
function(NODE,REF_NODE,TYPE,TREE_OBJ) { if(TREE_OBJ.container.find("#" + NODE.id.replace("_copy","")).size()) $(NODE).remove();
}
Awesome, thanks! That’s a lot cleaner than the mess I had!!!
That handles one of the two possible scenarios. It covers making sure that a node that already existed in tree2 when tree2 loaded is not duplicated.
What it doesn’t cover is if I drag a node from tree1 into a node in tree2, then immediately drag that same node into the same tree2 node again. Still end up with a duplicate.
One other oddity: I am using an ajax call to post tree changes to the server. After the call is complete, I am doing tree2.refresh() to try and show the saved changes. I am getting a “this.open is undefined”, Firefox says around line 654 of tree_component.js. Any idea what might be causing that?
@andy
For scenario 2 – replace the “.find” part with this:
.find("#" + NODE.id.replace("_copy","") + ", #" + NODE.id)
I believe this should work!
As for the refresh bug – I cannot reproduce it – which version are you using?
Thanks for the quick response!
I’m using v.0.9.1.
One other question (while I have your attention :)) :
When in async mode, is it possible to have a url value with a query string already started? For example, in a Fusebox environment, all URL’s have a “?fuseaction=c.xxxx” value appended to the url.
@andy
Could you send me your source files (only the ones related to the tree) so that I can reproduce the refresh bug.
As for the url – yes it is possible, but since 0.9.2 (the current version is 0.9.5 beta). But I am doing some final tests on it before releasing it as a featured download (big changes need a lot of testing – theme support, searching, etc).
Back to the URL – since 0.9.2 there is a callback function called async_data (“settings.data.async_data”), which should return a javascript object, that will be sent to the server as parameters (either get or post – this is controlled by “settings.data.method” – default is “get”).
So basically this should work:
...
data : {
...
url : "your-url-here",
async_data : function (NODE) {
return { id : jQuery(NODE).attr("id") || 0, fuseaction : "c.xxxx" }
}
...
}
...
I guess you could either browse the source at the SVN to download the latest, or wait a few days for the new download, or just add what you need in the 0.9.1 source (hardcode the needed parameter).
Hi Vakata.
I correct and test it(on PC only),
whis FF(3) : OK.
whis IE(7) : OK. but no ‘loading’ message.
whis Safari(3): 5-10 sec waiting, no ‘loading’ message.
whis Opéra(9): endless loop
whis chrome(beta): endless loop, no ‘loading’ message.
In addition for the next version , could you add a parameter for change the ‘default’ image path ?
For marker.gif, dot.git, ect…
@Alain
Version 0.9.5 (currently beta) adds theme support.
As for the endless loop – I’ll investigate further … the loop problem will be solved by setting a higher value. But I’ll look into the loading message.