# Checkbox TreeView availability?

**URL:** <https://www.ruby-forum.com/t/checkbox-treeview-availability/98302>\
**Category:** Ruby\
**Created:** [July 13, 2006, 6:56pm UTC](https://www.ruby-forum.com/t/checkbox-treeview-availability/98302 "2006-07-13T18:56:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/977dab/32.png) [@mikec](https://www.ruby-forum.com/u/mikec)\
**Post date:** [July 13, 2006, 6:56pm UTC](https://www.ruby-forum.com/t/checkbox-treeview-availability/98302/1 "2006-07-13T18:56:28Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![mikec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/977dab/32.png) [@mikec](https://www.ruby-forum.com/u/mikec)\
**Post date:** [July 13, 2006, 8:41pm UTC](https://www.ruby-forum.com/t/checkbox-treeview-availability/98302/2 "2006-07-13T20:41:01Z")

</div>

I did something like this, which I describe in this blog entry.

[http://blog.wolfman.com/articles/2006/05/20/role-based-authentication-admin-page](http://blog.wolfman.com/articles/2006/05/20/role-based-authentication-admin-page)

It is simple, and I have seen the set all and clear all implemented in  
java script,  
I’ll try to dig that up and add it to the blog.

---

<div class="post-metadata">

**Author:** ![mikec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/977dab/32.png) [@mikec](https://www.ruby-forum.com/u/mikec)\
**Post date:** [July 13, 2006, 8:47pm UTC](https://www.ruby-forum.com/t/checkbox-treeview-availability/98302/3 "2006-07-13T20:47:32Z")

</div>

On Jul 13, 2006, at 9:56 AM, mike courtney wrote:

> Does anyone know of a RoR implementation […]

Please ask Rails questions on the Rails mailing lists.

[http://lists.rubyonrails.org/](http://lists.rubyonrails.org/)

–  
Eric H. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)

---

<div class="post-metadata">

**Author:** ![mikec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/977dab/32.png) [@mikec](https://www.ruby-forum.com/u/mikec)\
**Post date:** [July 17, 2006, 9:45am UTC](https://www.ruby-forum.com/t/checkbox-treeview-availability/98302/4 "2006-07-17T09:45:57Z")

</div>

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\</a\>  
\<a href="#" onclick=“uncheckAll(‘permissions\_\<%= controller\_id %\>[]’);  
return false;”\>none\</a\>

The java script is…

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

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

---

<div class="post-metadata">

**Author:** ![mikec](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/977dab/32.png) [@mikec](https://www.ruby-forum.com/u/mikec)\
**Post date:** [July 15, 2006, 6:03pm UTC](https://www.ruby-forum.com/t/checkbox-treeview-availability/98302/5 "2006-07-15T18:03:14Z")

</div>

Jim M. wrote:

> I did something like this, which I describe in this blog entry.
> 
> [Wolfmans Howlings](http://blog.wolfman.com/articles/2006/05/20/role-based-authentication-admin-page)
> 
> It is simple, and I have seen the set all and clear all implemented in  
> java script,  
> I’ll try to dig that up and add it to the blog.

Thank you for the information Jim. Pls let me know if/when you add it to  
the blog.

Cheers.
