Here's a tree control that uses semantic HTML, unobtrusive JavaScript, and is easily reusable in a bundle of applications.
Here's the first of what will hopefully be a bunch of code that we donate to the web at large. I made this a few months ago, but it's been serving me well.
There are a lot of tree controls out there, but most of them are tacky, heavyweight relics of the"DHTML" era. I felt it was time for a change. In particular, I wanted to adopt "unobtrusive javascript" techniques. Among other things, the script has these notable features:
Go here for demo, instructions, and a bit of information about how I put it together.
If you've got comments, requests, suggestions, etc, email me on sam@silverstripe.com.
1 Comments. Add Yours Tags: tree control
You mention that there are a lot of tree controls out there, but I am having trouble finding one to use in rails apps that has the features I want.
1. Use <ul>
2. Unobtrusive javascript
3. Manage node selection
4. Manage node re-organization (move up/down/in/out)
5. Manage creation of new nodes
Creation/reorganization of nodes should happen server side, but it would be nice if the tree control abstracted the set of events. What would be really good is if the tree control would be smart enough to only redraw the section of tree that changed after a create/delete/re-organize event. So if I have a node selected and I click move_out, the remote service need only return the grandparent & children and the tree control manages the re-drawing. Similarly with delete, the remote service needs only return success/failure and the tree control removes the element on success.
Does anything like this exist?
Posted by Michael Johnston, 3 years ago
RSS feed for comments on this page | RSS feed for all comments
Looking for our Open Source Software? Then head to SilverStripe.org.
Comments on this website? Please give feedback.