[Users] button to uncheck all the layers in my Ext.tree.TreePanel
Jacinto Estima
jacinto.estima at gmail.com
Wed Sep 5 11:15:31 CEST 2012
Sure! If you need some explanation, just ask.
function unchecNodes(node) {
for (var counter = 5; counter < map.layers.length; ++counter) {
map.layers[counter].setVisibility(false);
}
}
var unckeckAll = new Ext.Button({
text: "Uncheck All",
handler: unchecNodes
});
From: Robert Buckley [mailto:robertdbuckley at yahoo.com]
Sent: Wednesday, September 05, 2012 1:12 PM
To: Jacinto Estima
Subject: Re: [Users] button to uncheck all the layers in my Ext.tree.TreePanel
HI,
any chance you can post the code you used to implement this? It would be very usefull to the community, and myself in particular.
Thanks,
Robert
_____
Von: Jacinto Estima <jacinto.estima at gmail.com>
An: 'Bart van den Eijnden' <bartvde at opengeo.org>
CC: users at geoext.org
Gesendet: 9:37 Mittwoch, 5.September 2012
Betreff: Re: [Users] button to uncheck all the layers in my Ext.tree.TreePanel
Thanks Bart. I followed your recommendation to loop over the layers and it’s working.
Regards,
Jacinto
From: Bart van den Eijnden [mailto:bartvde at opengeo.org]
Sent: Wednesday, September 05, 2012 10:41 AM
To: Jacinto Estima
Cc: users at geoext.org
Subject: Re: [Users] button to uncheck all the layers in my Ext.tree.TreePanel
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 <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
<mailto:Users at geoext.org> Users at geoext.org
<http://www.geoext.org/cgi-bin/mailman/listinfo/users> http://www.geoext.org/cgi-bin/mailman/listinfo/users
_______________________________________________
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/30e79eec/attachment-0001.htm
More information about the Users
mailing list