[Users] ExtJs Create Radio Button Tree Nodes

Andreas Hocevar ahocevar at opengeo.org
Wed Nov 24 08:59:06 CET 2010


Hi,

On Nov 23, 2010, at 22:01 , IT Intern wrote:

> Hello GeoExt users,
> 
> I have an Ext.tree.TreePanel that I later add a layer to one of it's child containers after that container has been created. The child container is an GeoExt.tree.OverlayLayerContainer. The two things that I am struggling with are how to set the tree nodes of an GeoExt.tree.OverlayLayerContainer to radio buttons instead of checkboxes?

Configure the nodes with a group attribute. Then you will get a radio button instead of a checkbox, which will also make the checked layer mutually exclusive:

loader: {
   baseAttrs: {group: "foo"}
}

> and how do I add nodes later on to the container?

The OverlayLayerContainer is synchronized with the map's layers. No need to add nodes manually.


> My attempt at this is below:
> 
> function childContainer(text, layerStore, parent, iconCls){
> 
> 
>        parent.appendChild(new GeoExt.tree.OverlayLayerContainer({
> 
>            text
> : text,
>            layerStore: layerStore,
> 
>            expanded
> : true,
>            iconCls: iconCls,  //If not specified, defaults to original image
> 
>            loader
> : {param: "LAYERS"}

What are you expecting this loader to do? The OverlayLayerContainer uses a LayerLoader, which has no param config option.

Regards,
Andreas.

> 
> 
> }));
> 
> }//end childContainer
> 
> //Container for photo layers
> 
>            childContainer
> ("Photo Layers", photoLayers, layerRoot);
> 
> 
> //In another function
> map.addLayer(vectorPano);
> 
> 
> layerStore.loadData([vectorPano], true);
> 
> 
> var panoNode = new Ext.tree.TreeNode({
> 
>            leaf
> : true,
>            text: 'Panoramio Photos',
> 
> 
> checked: false
> 
>        });
> 
>        panoNode
> .addListener("radiochange", function(){
> 
>            vectorPano
> .setVisibility(true);
>        });
> 
> 
> var layerContainer = layerRoot.findChild('text', 'Photo Layers');
> 
>        layerContainer
> .appendChild(panoNode);
> Currently a node is added, but it is a checkbox and when it is clicked on and off it does not turn the layer on/off. I'd prefer radio buttons nodes..
> 
> Thank you for your time,
> 
> elshae
> 
> 
> _______________________________________________
> 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