Hi,<div><br></div><div>I'm trying to merge MVC simple (<i><a href="http://geoext.github.com/geoext2/examples/app/simple/simple.html">http://geoext.github.com/geoext2/examples/app/simple/simple.html</a></i>) and tree (<i><a href="http://geoext.github.com/geoext2/examples/tree/tree.html">http://geoext.github.com/geoext2/examples/tree/tree.html</a></i>) 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 <i>CF.store.Layers</i> is defined, map controller is not yet initialized, then <i><b>mapPanel.layers</b></i>:is undefined. Do you know how to postpone the store creation after the map initialization?</div>
<div><br></div><div>thanks a lot</div><div>Antonio</div><div><br></div><div><b>Layer Store</b></div><div><br></div><div><div><i>Ext.define('CF.store.Layers', {</i></div><div><i> extend: 'Ext.data.TreeStore',</i></div>
<div><i> model: 'GeoExt.data.LayerTreeModel',</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">        </span>root: {</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                </span>expanded: true,</i></div>
<div><i><span class="Apple-tab-span" style="white-space:pre">                </span>children: [</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                        </span>{</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>plugins: [{</i></div>
<div><i><span class="Apple-tab-span" style="white-space:pre">                                        </span>ptype: 'gx_layercontainer',</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                        </span><b>store: mapPanel.layers</b><span class="Apple-tab-span" style="white-space:pre">                        </span></i></div>
<div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>}],</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>expanded: true</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                        </span>}, {</i></div>
<div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>plugins: ['gx_baselayercontainer'],</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>expanded: true,</i></div>
<div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>text: "Base Maps"</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                        </span>}, {</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>plugins: ['gx_overlaylayercontainer'],</i></div>
<div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>expanded: true</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                        </span>}</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                </span>]</i></div>
<div><i><span class="Apple-tab-span" style="white-space:pre">        </span>}<span class="Apple-tab-span" style="white-space:pre">        </span></i></div><div><i>});</i></div><div><br></div><div><br></div><div><b>East Panel</b></div><div>
<br></div><div><div><i>items: [</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>Ext.create('GeoExt.tree.Panel', {</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>region: "east",</i></div>
<div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>border: true,</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>title: "Layers",</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>width: 200,</i></div>
<div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>split: true,</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>collapsible: true,</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>collapseMode: "mini",</i></div>
<div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>autoScroll: true,</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                </span><b>store: 'Layers',</b></i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>root: {</i></div>
<div><i><span class="Apple-tab-span" style="white-space:pre">                                        </span>text: 'root node'</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>},<span class="Apple-tab-span" style="white-space:pre">                                </span></i></div>
<div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>rootVisible: false,</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>lines: false,</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>tbar: [{</i></div>
<div><i><span class="Apple-tab-span" style="white-space:pre">                                        </span>text: "remove",</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                        </span>handler: function() {</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                                </span>layer = mapPanel.map.layers[2];</i></div>
<div><i><span class="Apple-tab-span" style="white-space:pre">                                                </span>mapPanel.map.removeLayer(layer);</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                        </span>}</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>}, {</i></div>
<div><i><span class="Apple-tab-span" style="white-space:pre">                                        </span>text: "add",</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                        </span>handler: function() {</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                                </span>mapPanel.map.addLayer(layer);</i></div>
<div><i><span class="Apple-tab-span" style="white-space:pre">                                        </span>}</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>}]</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                        </span>})</i></div>
</div><div><i>]</i></div>- Antonio<br>
</div>