# Checkbox TreeView availability?

**URL:** <https://rubytalk.org/t/checkbox-treeview-availability/28937>\
**Category:** ruby-talk\
**Created:** [13 July 2006 16:56 UTC](https://rubytalk.org/t/checkbox-treeview-availability/28937 "2006-07-13T16:56:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike\_courtney](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@mike\_courtney](https://rubytalk.org/u/mike_courtney)\
**Post date:** [13 July 2006 16:56 UTC](https://rubytalk.org/t/checkbox-treeview-availability/28937/1 "2006-07-13T16:56:42Z")

</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

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Jim\_Morris](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@Jim\_Morris](https://rubytalk.org/u/Jim_Morris)\
**Post date:** [13 July 2006 18:39 UTC](https://rubytalk.org/t/checkbox-treeview-availability/28937/2 "2006-07-13T18:39:29Z")

</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.  
&nbsp;&nbsp;  
mike courtney wrote:

> **···**
>
> > 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%5C). 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
> 
> --  
> Jim Morris, [http://blog.wolfman.com](http://blog.wolfman.com)

---

<div class="post-metadata">

**Author:** ![Eric\_Hodel1](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Eric\_Hodel1](https://rubytalk.org/u/Eric_Hodel1)\
**Post date:** [13 July 2006 18:44 UTC](https://rubytalk.org/t/checkbox-treeview-availability/28937/3 "2006-07-13T18:44:05Z")

</div>

Please ask Rails questions on the Rails mailing lists.

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

> **···**
>
> On Jul 13, 2006, at 9:56 AM, mike courtney wrote:
> 
> > Does anyone know of a RoR implementation [...]
> 
> --  
> Eric Hodel - drbrain@segment7.net - [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:** ![mike\_courtney](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@mike\_courtney](https://rubytalk.org/u/mike_courtney)\
**Post date:** [15 July 2006 16:03 UTC](https://rubytalk.org/t/checkbox-treeview-availability/28937/4 "2006-07-15T16:03:43Z")

</div>

Jim Morris 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.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Jim\_Morris](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@Jim\_Morris](https://rubytalk.org/u/Jim_Morris)\
**Post date:** [17 July 2006 07:43 UTC](https://rubytalk.org/t/checkbox-treeview-availability/28937/5 "2006-07-17T07:43:05Z")

</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...

&nbsp;&nbsp;&nbsp;\<a href="#" onclick="checkAll('permissions\_\<%= controller\_id %\>'); return false;"\\>all&lt;/a\>  
&nbsp;&nbsp;&nbsp;\<a href="#" onclick="uncheckAll('permissions\_\<%= controller\_id %\>'); return false;"\\>none&lt;/a\>

The java script is...

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

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

mike courtney wrote:

> **···**
>
> > Jim Morris 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.
> 
> --  
> Jim Morris, [http://blog.wolfman.com](http://blog.wolfman.com)
