Checkbox TreeView availability ?

M

mike courtney

Does anyone know of a RoR implementation of a TreeView in which you can
navigate to leafs of branches and select multiple leafs of interest via
checkboxes. An example of this is the javascript Checkbox Tree available
at http://www.treeview.net/treemenu/3fr_checkbox.html. It is also nice
to be able to open all or close all branches via a button, and to select
all leafs or unselect all of them.

I would rather not have to build this from scratch as I have plenty of
other RoR work that I want to do. Thanks for any solid leads on this
subject.

Regards,
Mike
 
J

Jim Morris

I added the entry to my blog, it looks like this...

This is done with a little bit of javascript.

The view code looks like...


<a href="#" onclick="checkAll('permissions_<%= controller_id %>[]'); return false;"\>all&lt;/a>
<a href="#" onclick="uncheckAll('permissions_<%= controller_id %>[]'); return false;"\>none&lt;/a>

The java script is...

function checkAll(name)
{
boxes = document.getElementsByName(name)
for (i = 0; i < boxes.length; i++)
boxes.checked = true ;
}

function uncheckAll(name)
{
boxes = document.getElementsByName(name)
for (i = 0; i < boxes.length; i++)
boxes.checked = false ;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top