[Users] MVC Simple + treelayer

Antonio Parrotta antonioparrotta at gmail.com
Tue Nov 20 01:58:06 CET 2012


Hi,

I'm trying to merge MVC simple (*
http://geoext.github.com/geoext2/examples/app/simple/simple.html*) and tree
(*http://geoext.github.com/geoext2/examples/tree/tree.html*) examples . I
created a new east panel in the viewport and a Layer.js store as reported
below. The problem here is that at the time *CF.store.Layers* is defined,
map controller is not yet initialized, then *mapPanel.layers*:is undefined.
Do you know how to postpone the store creation after the map initialization?

thanks a lot
Antonio

*Layer Store*

*Ext.define('CF.store.Layers', {*
*    extend: 'Ext.data.TreeStore',*
*    model: 'GeoExt.data.LayerTreeModel',*
* root: {*
* expanded: true,*
* children: [*
* {*
* plugins: [{*
* ptype: 'gx_layercontainer',*
* store: mapPanel.layers *
* }],*
* expanded: true*
* }, {*
* plugins: ['gx_baselayercontainer'],*
* expanded: true,*
* text: "Base Maps"*
* }, {*
* plugins: ['gx_overlaylayercontainer'],*
* expanded: true*
* }*
* ]*
* } *
*});*


*East Panel*

*items: [*
* Ext.create('GeoExt.tree.Panel', {*
* region: "east",*
* border: true,*
* title: "Layers",*
* width: 200,*
* split: true,*
* collapsible: true,*
* collapseMode: "mini",*
* autoScroll: true,*
* store: 'Layers',*
* root: {*
* text: 'root node'*
* }, *
* rootVisible: false,*
* lines: false,*
* tbar: [{*
* text: "remove",*
* handler: function() {*
* layer = mapPanel.map.layers[2];*
* mapPanel.map.removeLayer(layer);*
* }*
* }, {*
* text: "add",*
* handler: function() {*
* mapPanel.map.addLayer(layer);*
* }*
* }]*
* })*
*]*
- Antonio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20121120/5b537037/attachment.htm 


More information about the Users mailing list