October 21, 2005
Hierarchical list dragging
I'm afraid this is work related, but in a slightly different fashion from usual. After wittering on yesterday about whizzy javascript, I thought I might as well show you just what I've been up to. The reason for putting it up here is because I've been feeling an even greater need to show off than is usual for me, and I think this is rather cool. Do bear in mind that it's just a prototype, and still needs a lot of work. It's over here, btw - drag and drop the list items around. I've seen scripts around for handling dragging list elements around, but nothing that handles nested lists. Doing so is really rather intricate. I'm reminded of an old adage about difficulty involved in learning to juggle: On a difficulty scale of 1 to 10, with 10 being most difficult, juggling three balls is 2, juggling four balls is 5, and juggling five balls is 34. Basically ordering a single list is relatively straightforward, ordering a hierarchy is a whole different ball game. Still, I'm pleased with the results, although there remains one case in particular that I've been struggling to handle in an elegant fashion, namely moving list items horizontally, rather than vertically, to change the hierarchies. At the moment, this is handled separately by pressing the control key and then dragging left and right. I want to integrate it in a more natural fashion, since it's rather awkward at present, though I'm not sure I can afford to spend much more time doing so. What I really need to do is make it obvious which items can be dragged in and out in this fashion, since it's not obvious at glance. Once I'm done this will form part of a web based utility to manage pages on a site, allowing existing pages to be rearranged and new pages to be inserted. The site navigation will update accordingly. I've already written the back end for it, I just need to finish off the interface. Anyway. That's it. If you've ever wondered what I spend my days doing (and goodness knows I have), this is it. And I get paid for it too. It really is a strange old world... Thought iMark at October 21, 2005 12:29 AM | TrackBackComments
Very nice! Now, for this to be perfect IMO it should have a way to "group" the elements again, because moving elements out of their level works really great, but there is no way to start making it nested again if you've moved all elements to the "root".
What do you think? :)
Posted by: Tommy at November 3, 2005 12:16 PMPost a comment