[Users] button to uncheck all the layers in my Ext.tree.TreePanel

Bart van den Eijnden bartvde at opengeo.org
Wed Sep 5 08:40:50 CEST 2012


The function argument of cascade gets a node argument, use that in function f instead of LayerTree.

Alternatively, just loop over the layers and call setVisibility(false), the tree will update itself.

Best regards,
Bart

-- 
Bart van den Eijnden
OpenGeo - http://opengeo.org
Expert service straight from the developers.



On Sep 5, 2012, at 8:36 AM, Jacinto Estima <jacinto.estima at gmail.com> wrote:

> Hi,
>  
> I am trying to develop a button to uncheck all the layers in my Ext.tree.TreePanel but without success so far.
> Does anyone have ideas?
>  
> I’m using the following code that I’ve found:
>  
> var unckeckAll = new Ext.Button({
>               text: "Uncheck All",
>               listeners:{
>                      reset: function (){
>                    startNode = LayerTree.root;
>                    var f = function () {
>                        if (LayerTree.attributes.checked) {
>                             LayerTree.attributes.checked = false;
>                             LayerTree.getUI().toggleCheck(false);
>                        }
>                    };
>                    startNode.cascade(f);
>                }
>            }           
>        });
>  
> Thanks,
> Jacinto
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20120905/2c6209a2/attachment.htm 


More information about the Users mailing list