[Users] Help with layer tree and radio buttons

Andreas Hocevar ahocevar at opengeo.org
Tue Oct 27 19:07:28 CET 2009


Dan Ramage wrote:
> Andreas,
> 
> Thanks for the response. A followup question if you don't mind.
> If I have multiple groupings of layers, say a group called Radar and a group
> called Underwater Hazards, would each have an entry of
> nodeType: "gx_overlaylayercontainer",
> expanded: true,
> loader: {
>   baseAttrs: {radioGroup: "foo"}
>  }
> ? That most likely is not the right method, but I am not sure how you
> associate certain layers to a specific group.

That's ok. You can configure the loader with a filter function. This may 
help you to accomplish the grouping. See 
http://geoext.org/lib/GeoExt/widgets/tree/LayerLoader.html#GeoExt.tree.LayerLoader 
for documentation.

Regards,
Andreas.


> 
> 
> 
> Thanks again,
> 
> Dan
> 
> -----Original Message-----
> From: Andreas Hocevar [mailto:ahocevar at opengeo.org] 
> Sent: Tuesday, October 27, 2009 1:44 PM
> To: Dan Ramage
> Cc: users at geoext.org
> Subject: Re: [Users] Help with layer tree and radio buttons
> 
> Hi,
> 
> Dan Ramage wrote:
>> I'd like to implement a layer tree that makes use of the check box to 
>> turn on the layer and the radio button to allow the layer to be queried.
>>
>> I've been looking over the 
>> http://dev.geoext.org/trunk/geoext/examples/tree.js example, however I 
>> am just not following how it works at all.
>>
>> I understand that the JSON is used to configure the layer tree, 
>> however I do not understand how most of the nodes get added.
>>
>> For instance, in the treeConfig variable, the first entry is: nodeType:
> "gx_baselayercontainer" and from the documentation I see that 
>> gx_baselayercontainer will place all the base layer layers in that node. 
>>  
>> The second entry of: 
>> nodeType: "gx_overlaylayercontainer",
>> expanded: true,
>> loader: {
>>   baseAttrs: {radioGroup: "foo"}
>>  }
>> is where I cannot follow. I don't see how that relates to the layers that
> end up in the "Overlays" node.
>> Can someone explain how this works? I might be missing something
> fundamental, but I am lost at the moment.
> 
> This works exactly like the gx_baselayercontainer, but for the overlays. 
> The loader configuration (loader: {baseAttrs...) tells the loader to add 
> a radio button with the radio group "foo" to all overlay layer nodes.
> 
> Regards,
> Andreas.
> 


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


More information about the Users mailing list