[Users] LayerNode with radio button

Hugo hfpmartins at gmail.com
Sat Dec 4 19:28:21 CET 2010


Hello all,

I've been able to create node inside a tree using the radiobutton plugin.
However, im'not able to aply it into a single LayerNode. I have a tree with
a folder (node) that will contain several other folders (nodes) and layers
(leaf nodes). Because i want to achieve a specific node order inside the
tree i've been using both LayerConatiner and LayerNode. The problem is with
the latest. Here is the relevant part of the code:

var layerRoot = new Ext.tree.TreeNode({});

var themeNode = new Ext.tree.TreeNode({
      text: 'Cartografia Temática',
      expandable: true,
      expanded: true
});

var magua = new Ext.tree.TreeNode({
     text: 'Massas de água por categoria',
     expandable: true,
     expanded: false
});

var riosLayerStore = new GeoExt.data.LayerStore({
     map: map,
     initDir: 0,
     layers: [mrios, martif]
});

var lagosLayerStore = new GeoExt.data.LayerStore({
     map: map,
     initDir: 0,
     layers: [mlago]
});

var riosLayerCont = new GeoExt.tree.LayerContainer({
     text: 'Rios',
     layerStore: riosLayerStore,
     expanded: false,
     loader: {
           baseAttrs: {
               radioGroup: 'theme',
               uiProvider: 'layernodeui'
            }
     }
});

var lagosLayerNode = new GeoExt.tree.LayerNode({
     layer: mlago,
     leaf: true,
     loader: {
           baseAttrs: {
                radioGroup: 'theme',
                uiProvider: 'layernodeui'
           }
     }
});

var layerTree = new Ext.tree.TreePanel({
      title: 'Temas',
      layout: 'fit',
      root: layerRoot,
      rootVisible: false,
      loader: new Ext.tree.TreeLoader({applyloader: false}),
      enableDD: false,
      autoScroll: true,
      expanded: true,
      border: true,
      plugins: [
            new GeoExt.plugins.TreeNodeRadioButton({
                   listeners: {
                       'radiochange': function(node) {
                            selLayer = node.layer;
                            featureInfo.layers = [selLayer];
                        }
                   }
            })
      ],
      loader: new Ext.tree.TreeLoader({
            applyLoader: false,
            uiProviders: {
                    'layernodeui': LayerNodeUI
            }
      })
});

layerRoot.appendChild(themeNode);
themeNode.appendChild(magua);
magua.appendChild(riosLayerCont);
magua.appendChild(lagosLayerNode);

So it works when i append riosLayerCont but doesn't when appending
lagosLayerNode.
Any help? What am i doing wrong here?

Thanks a lot. Best regards,

Hugo


-- 
Hugo Martins
LabNT - ISEGI UNL
Campus de Campolide
1070-312 Lisboa
N 38°43'56.84", W 9°9'35.74"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101204/acf9fe80/attachment.htm 


More information about the Users mailing list