Hi,<div><br></div><div>I&#39;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(&#39;CF.store.Layers&#39;, {</i></div><div><i>    extend: &#39;Ext.data.TreeStore&#39;,</i></div>
<div><i>    model: &#39;GeoExt.data.LayerTreeModel&#39;,</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: &#39;gx_layercontainer&#39;,</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: [&#39;gx_baselayercontainer&#39;],</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: &quot;Base Maps&quot;</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: [&#39;gx_overlaylayercontainer&#39;],</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(&#39;GeoExt.tree.Panel&#39;, {</i></div><div><i><span class="Apple-tab-span" style="white-space:pre">                                </span>region: &quot;east&quot;,</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: &quot;Layers&quot;,</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: &quot;mini&quot;,</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: &#39;Layers&#39;,</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: &#39;root node&#39;</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: &quot;remove&quot;,</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: &quot;add&quot;,</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>