[OpenLayers-Users] [Users] Tree not working

Andreas Hocevar ahocevar at opengeo.org
Mon Jul 9 02:13:29 PDT 2012


Please reply to the list, so others can benefit from the advice given
here as well.

Instead of creating an Ext.tree.TreeNode, you have to create a
GeoExt.tree.LayerNode instance for your layer.

Trailing commas are e.g. the commas here: {foo: "bar",} or ["foo",].

Andreas.

On Mon, Jul 9, 2012 at 10:19 AM, Jacinto Estima
<jacinto.estima at gmail.com> wrote:
> Thanks for the reply Andreas. With "urgent", my idea was not impress the
> volunteers. The thing is that I have to finish as soon as possible a work
> that I have in hands (only that). I respect very much their efforts as I am
> also a volunteer. I hope you don't interpret me wrong.
>
> Regarding my issue, I put the "leaf: true" in the node layer and "leaf:
> false" in the other ones. Still don't work. When I try to open the "images"
> folder, the node stays rounding, thrying to load something but that never
> happends.
>
> var LayerTree = new Ext.tree.TreePanel({
>                renderTo: 'layers',
>                root: {
>                 nodeType: "async",
>                 text: "Layers",
>                 expanded: true,
>         leaf: false,
>                 children: [
>                       new Ext.tree.TreeNode({
>  //                          nodeType: "folder",
>                 text: "Images",
>                 leaf: false,
>                 children: [
>                                         new Ext.tree.TreeNode({
>                                         nodetype: "gx_layer",
>                                         layer: G2008_feb,
>                         leaf: true,
>                                         }),
>                              ]
>                       })
>                 ]
>             },
>         });
>
>
>
> I would appreciate if you can clarify me with your last sentence: " And
> beware of trailing commas ".
>
> Thanks again,
> Jacinto
>
> -----Original Message-----
> From: andreas.hocevar at gmail.com [mailto:andreas.hocevar at gmail.com] On Behalf
> Of Andreas Hocevar
> Sent: Monday, July 09, 2012 12:02 PM
> To: Jacinto Estima
> Subject: Re: [Users] Tree not working
>
> Stating that something is urgent will not impress any of the volunteers on
> this list. Regarding your issue, since you have configured your tree to be
> async: true, you will have to configure your layer node with leaf: true,
> otherwise the loader does not know that there are no children.
>
> And beware of trailing commas, they will break your app in IE.
>
> Andreas.
>
> On Mon, Jul 9, 2012 at 9:51 AM, Jacinto Estima <jacinto.estima at gmail.com>
> wrote:
>> Please, any ideas on this?
>>
>>
>>
>> From: Jacinto Estima [mailto:jacinto.estima at gmail.com]
>> Sent: Sunday, July 08, 2012 9:44 PM
>> To: users at geoext.org
>> Subject: Tree not working
>>
>>
>>
>> Hi folks,
>>
>>
>>
>> I created a tree but when a try to open one node that should show a
>> layer, the layer is not shown on the tree, and the tree stays always
>> trying to load it.
>>
>> Can you give me some help? It is urgent, please.
>>
>>
>>
>> The code follows below.
>>
>>
>>
>> By the way, I am using ExtJs 3.4.
>>
>>
>>
>> Thank you and best regards,
>>
>> Jacinto
>>
>>
>>
>> var G2008_feb = new OpenLayers.Layer.WMS("2008_G_feb",
>>
>>                   "http://localhost:8080/geoserver/personal/wms", {
>>
>>                       layers: "personal:2008_G_feb",
>>
>>                       transparent: true,
>>
>>                       format: format,
>>
>>                       tiled: true,
>>
>>                       tilesOrigin : map.maxExtent.left + ',' +
>> map.maxExtent.bottom
>>
>>                   }, {
>>
>>                 buffer: 0,
>>
>>                 displayOutsideMaxExtent: true,
>>
>>                 ratio: 1,
>>
>>                      opacity: 1,
>>
>>             }
>>
>>               );
>>
>>
>>
>>        map.addLayer([G2008_feb]);
>>
>>
>>
>> var LayerTree = new Ext.tree.TreePanel({
>>
>>               renderTo: 'layers',
>>
>>               root: {
>>
>>                nodeType: "async",
>>
>>                text: "Layers",
>>
>>                expanded: true,
>>
>>                children: [
>>
>>                      new Ext.tree.TreeNode({
>>
>> //                          nodeType: "folder",
>>
>>                             text: "Images",
>>
>>                             children: [
>>
>>                                        new Ext.tree.TreeNode({
>>
>>                                              nodetype: "gx_layer",
>>
>>                                              layer: G2008_feb,
>>
>>                                        }),
>>
>>
>>
>>                             ]
>>
>>                      })
>>
>>                ]
>>
>>            },
>>
>>        });
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at geoext.org
>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>
>
>
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list