<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
        {mso-style-priority:99;
        mso-style-link:"Corps de texte Car";
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoSalutation, li.MsoSalutation, div.MsoSalutation
        {mso-style-priority:99;
        mso-style-link:"Salutations Car";
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.SalutationsCar
        {mso-style-name:"Salutations Car";
        mso-style-priority:99;
        mso-style-link:Salutations;
        font-family:"Times New Roman","serif";}
span.CorpsdetexteCar
        {mso-style-name:"Corps de texte Car";
        mso-style-priority:99;
        mso-style-link:"Corps de texte";
        font-family:"Times New Roman","serif";}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-CA link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hello,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I tried your code with my WMS server and it does not work. The tree is empty.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Frank<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=FR style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>De :</span></b><span lang=FR style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Christoph Mayrhofer [mailto:christoph.mayrhofer@drei.at] <br><b>Envoyé :</b> 18 avril 2013 11:55<br><b>À :</b> Valiquette,Francois [Montreal]<br><b>Cc :</b> users@geoext.org<br><b>Objet :</b> RE: [Users] Add all geoserver layers automatically<o:p></o:p></span></p></div><p class=MsoNormal><o:p> </o:p></p><p>Hi François,<o:p></o:p></p><p>I just tried it with the following code, but there are no nodes listed in the tree.<br>Could the url parameter be the problem?: http://localhost:8080/geoserver/wms<o:p></o:p></p><p>var root = new Ext.tree.AsyncTreeNode({<br> text: 'All Layers', <br> loader: new GeoExt.tree.WMSCapabilitiesLoader({<br> url: 'http://localhost:8080/geoserver/wms', <br> layerOptions: {buffer: 0, singleTile: true, ratio: 1},<br> layerParams: {'TRANSPARENT': 'TRUE'}, <br> // customize the createNode method to add a checkbox to nodes <br> createNode: function(attr) {<br> attr.checked = attr.leaf ? false : undefined; <br> return GeoExt.tree.WMSCapabilitiesLoader.prototype.createNode.apply(this, [attr]); <br> } <br> }) <br>});<o:p></o:p></p><p>tree = new Ext.tree.TreePanel({ <br> root: root,<br> region: 'west',<br> width: 250,<br> listeners: { <br> // Add layers to the map when ckecked, remove when unchecked.<br> // Note that this does not take care of maintaining the layer order on the map.<br> 'checkchange': function(node, checked) {<br> if (checked === true) {<br> mapPanel.map.addLayer(node.attributes.layer);<br> } else {<br> mapPanel.map.removeLayer(node.attributes.layer);<br> }<br> } <br> }<br>});<o:p></o:p></p><p>regards, Chris<o:p></o:p></p><p>On Thu, 18 Apr 2013 10:25:19 -0400, "Valiquette,Francois [Montreal]" <Francois.Valiquette@ec.gc.ca> wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #1010FF 1.5pt;padding:0cm 0cm 0cm 4.0pt;margin-left:3.75pt;margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoSalutation>Hello Chris,<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoBodyText>Yes you can, you need to make a query on your server to get the GetCapabilities XML (a list of all the available layers and options).<o:p></o:p></p><p class=MsoBodyText>The GeoExt.data.WMSCapabilitiesStore can make the query for you by giving it an URL. Then, it will return you a set of records. Afterward with the records, you can generate manually a Tree for a greater flexibility.<o:p></o:p></p><p class=MsoBodyText>Otherwise, I think you can use GeoExt.tree.WMSCapabilitiesLoader to generate the Tree automatically for you. <o:p></o:p></p><p class=MsoBodyText> <o:p></o:p></p><p class=MsoBodyText>Here is an exemple of a valid XML file :<o:p></o:p></p><p class=MsoBodyText>http://api.geoext.org/1.1/examples/data/wmscap.xml<o:p></o:p></p><p class=MsoBodyText><br>François<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><strong><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>De :</span></strong><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> users-bounces@geoext.org [mailto:users-bounces@geoext.org] <strong><span style='font-family:"Tahoma","sans-serif"'>De la part de</span></strong> Christoph Mayrhofer<br><strong><span style='font-family:"Tahoma","sans-serif"'>Envoyé :</span></strong> 18 avril 2013 10:05<br><strong><span style='font-family:"Tahoma","sans-serif"'>À :</span></strong> users@geoext.org<br><strong><span style='font-family:"Tahoma","sans-serif"'>Objet :</span></strong> [Users] Add all geoserver layers automatically</span><o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p>Hi,<o:p></o:p></p><p>I saw some examples that had a List of available layers and a button that you could click to add a selected layers to the map.<br>Is it possible to have all layers on a Geoserver instance automatically added to the map.<br>This would eliminate the need to change the JS code when a new layer is added to Geoserver.<o:p></o:p></p><p>regards, Chris<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p></div></div></blockquote><div><p class=MsoNormal> <o:p></o:p></p></div></div></body></html>