[Users] Display only radio buttons (not check boxes) with multiple overlay groups

Andreas Hocevar ahocevar at opengeo.org
Wed Sep 15 09:45:21 CEST 2010


Hi,

On Sep 15, 2010, at 04:07 , Lela Prashad wrote:

> I want to use GeoExt to have one base layer group (with multiple base
> layers)  using the gx_baselayercontainer node type and two other
> overlay groups  (each group with multiple layers) with async node
> type. I want to use radio buttons so that only one layer per overlay
> group shows up at any time.

For each group, create an OverlayLayerContainer with a filter function and a checkedGroup in the baseAttrs of the loader. Something like this:

var groupN = new GeoExt.OverlayLayerContainer({
    loader: {
        baseAttrs: {checkedGroup: "groupN"}
    },
    filter: function(record) {
        // return true for records you want in this group, otherwise false
    }
});

So to answer your question: yes, filter functions and setting checkedGroup is the way to go.

Regards,
Andreas.

> I used the TreeNodes example to create my two overlay groups
> (http://dev.geoext.org/trunk/geoext/examples/tree.html) and right now
> they are working with checkboxes - but I want radio buttons instead.
> 
> I tried to follow this GeoExt post on setting up radio buttons for
> subnode but found that Andreas said that the Treenodes example code
> segment
> OpenLayers.Format.JSON().write
> was not meant for "real-life application":
> http://www.geoext.org/pipermail/users/2009-October/000270.html
> 
> From this thread it seems that this piece of code keeps the baseAttrs
> method from rendering. I did have to comment these out to get my two
> overlay groups to work.
> 
> So I found another post that says we should be using filter functions
> to accomplish my goal of multiple groups of overlay layers.
> http://www.geoext.org/pipermail/users/2009-October/000325.html
> 
> I'm not sure where to go from here - what is the right way to create
> multiple overlay groups and how can select the layers within those
> groups with radio buttons instead of checkboxes?
> 
> My geoext implementation is here:
> http://maps.nijel.org/waterorg/map/
> 
> Thanks.
> _______________________________________________
> 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.



More information about the Users mailing list