[Users] Layertree with different sublayers

Kathrin Babiker k.babiker at gmx.de
Mon Sep 26 15:18:18 CEST 2011


Hi,
I need an idea to build a layertree with consists not only of baselayers 
and overlaylayers but also of different sublayers like this:
1 - background
2 - theme 1
   2-1 theme 1 subpoint A
       2-1-1 subsubpoint A-a
       2-1-2 subsubpoint A-b
       2-1-3 subsubpoint A-c
  2-2 theme 1 subpoint B
      2-2-1 subsubpoint B-a
      2-2-2 subsubpoint B-b
3 - theme 2
  3-1 theme 2 subpoint A
...
I mean it should look like a folder structure we know from our own PC.

I tried a layout (taken from tree.js from geoext) with OpenLayers, GeoExt 
and ExtJS but the structure is not going deep enough. The layers at 
subsubpoints should come from geoserver.


My code is like this:

var treeConfig = new OpenLayers.Format.JSON().write([{
        nodeType: "gx_baselayercontainer"
    }, {
        nodeType: "gx_overlaylayercontainer",
        expanded: true,
        // render the nodes inside this container with a radio 
button,
        // and assign them the group "foo".
        loader: {
            baseAttrs: {
                radioGroup: "foo",
                uiProvider: "layernodeui"
            }
        }
    }, {
        nodeType: "gx_layer",
        layer: "Europäische Union (Gruppe)",
        isLeaf: false,
        // create subnodes for the layers in the LAYERS param. If we 
assign
        // a loader to a LayerNode and do not provide a loader 
class, a
        // LayerParamLoader will be assumed.
        loader: {
            param: "LAYERS"
        }
    }], true);

    // create the tree with the configuration from above
    tree = new Ext.tree.TreePanel({
        border: true,
        region: "west",
        title: "Ebenen",
        width: 200,
        split: true,
        collapsible: true,
        collapseMode: "mini",
        autoScroll: true,

        loader: new Ext.tree.TreeLoader({
            // applyLoader has to be set to false to not 
interfer with loaders
            // of nodes further down the tree hierarchy
            applyLoader: false,
            uiProviders: {
                "layernodeui": LayerNodeUI
            }
        }),
        root: {
            nodeType: "async",
            // the children property of an 
Ext.tree.AsyncTreeNode is used to
            // provide an initial set of layer nodes. We use the 
treeConfig
            // from above, that we created with 
OpenLayers.Format.JSON.write.
            children: Ext.decode(treeConfig)
        },

        rootVisible: false,
        lines: false

    });

Is there anyone who can help me? There MUST be any possibility to get well 
structured tree, or?!
Thanks
Kathrin
      
-- 
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!		
Jetzt informieren: http://www.gmx.net/de/go/freephone
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110926/d8ea857f/attachment.htm 


More information about the Users mailing list