cgxp.plugins.LayerTree

ptype
cgxp_layertree
class cgxp.plugins.LayerTree(config)

Example Use

Sample code showing how to add the LayerTree, ThemeChooser and ThemeSelector plugins to a gxp.Viewer:

new gxp.Viewer({
    portalConfig: {
        layout: "border",
        // by configuring items here, we don't need to configure portalItems
        // and save a wrapping container
        items: [{
            region: "north",
            contentEl: 'header-out'
        },
        {
            region: 'center',
            layout: 'border',
            id: 'center',
            tbar: [],
            items: [
                "app-map"
            ]
        },
        {
            id: "featuregrid-container",
            xtype: "panel",
            layout: "fit",
            region: "south",
            height: 160,
            split: true,
            collapseMode: "mini",
            hidden: true,
            bodyStyle: 'background-color: transparent;'
        },
        {
            layout: "accordion",
            id: "left-panel",
            region: "west",
            width: 300,
            minWidth: 300,
            split: true,
            collapseMode: "mini",
            border: false,
            defaults: {width: 300},
            items: [{
                xtype: "panel",
                title: OpenLayers.i18n("layertree"),
                id: 'layerpanel',
                layout: "vbox",
                layoutConfig: {
                    align: "stretch"
                }
            }]
        }]
    },
    tools: [{
        ptype: "cgxp_themeselector",
        outputTarget: "layerpanel",
        layerTreeId: "layertree",
        themes: THEMES,
        outputConfig: {
            layout: "fit",
            style: "padding: 3px 0 3px 3px;"
        }
    },
    {
        ptype: "cgxp_themefinder",
        outputTarget: "layerpanel",
        layerTreeId: "layertree",
        themes: THEMES,
        outputConfig: {
            layout: "fit",
            style: "padding: 3px;"
        }
    },
    {
        ptype: "cgxp_layertree",
        id: "layertree",
        themes: THEMES,,
        // default themes works only with theme groups
        defaultThemes: ["default_theme_to_load"],
        wmsURL: "${request.route_url('mapserverproxy', path='')}",
        outputTarget: "layerpanel"
        outputConfig: {
            header: false,
            flex: 1,
            layout: "fit",
            autoScroll: true
        }
    },
    ...
    ]
    ...
});

Config Options

Configuration properties.

defaultThemes

Array(String) The themes to load at init time. Optional.

themes

Object List of internal and external themes. Mandatory.

wmsURL

String The URL of the WMS. Mandatory.

Table Of Contents

Previous topic

cgxp.plugins.Help

Next topic

cgxp.plugins.Legend

This Page