Nested sortable using jTree - clickable links

jTree is a lightweight solution for nested, sortable lists based on jQuery. I’ve been trying to find a good solution for quite a while, however the only good competitor to jTree is now not compatible with the new jQuery (1.2.6). After getting fed up at work with including totally different sets of javascript files depending on whether the nested sortable was needed on a page or not I have decided it was time for some clean-up.

Minimal is a very good word to describe jTree, which most of the time is good, however sometimes you might just want a little bit more. One of the biggest issues for me was lack of clickable links inside the LIs. Fortunately after some tweaking I came up with a hacky but working solution:

if ($("#jTreeHelper").is(":not(:animated)") && e.button !=2) { // Allow for clickable links if(new String(e.target).match(/(f|ht)tp(s{0,1}):///ig)){ return false;** }** $("body").css("cursor","move");

Just add the highlighted lines in the jquery.jtree.js file. Basically it just checks if the target of the click is a link and if it is it ignores the dragging.