[Users] Help with Layer tree on MVC application

Hugo hfpmartins at gmail.com
Wed Apr 9 20:03:12 CEST 2014


Hello all,

I'm trying to build a layer tree in MVC application. I'm trying to manually
set the tree nodes and not to use the map to store option. In the following
code, layers is an array of OpenLayers.Layer objects that have
displayInLayerSwitcher set to true.

var store = Ext.create('GeoExt.data.LayerStore', {
    map: map,
    initDir: 0,
    layers: layers
});

var loader = Ext.create('GeoExt.tree.LayerLoader', {
    store: store
});

var container = Ext.create('GeoExt.tree.BaseLayerContainer', {
    text: 'Arruamentos',
    expanded: true,
    loader: loader
});

After this i'm manually appending the container to the tree root node. In
the layer tree i get the parent node to be displayed (which is in fact the
container) but i have no child nodes.

My tree view is defined as follows:

Ext.define('labnt.view.TocPanel', {
    extend: 'GeoExt.tree.Panel',
    alias: 'widget.tocPanel',
    title: 'TOC',
    iconCls: 'tocPanel-icon',
    rootVisible: false,
    initComponent: function(){
        this.callParent();
    }
});

Any help would be very much appreciated :)

Kind regards,

-- 
Hugo Martins
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20140409/61f9939c/attachment.htm 


More information about the Users mailing list