<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi Antonio,<br>
<br>
Sorry for the late answer. Were you able to solve your issue ?<br>
<br>
Alexandre<br>
<br>
<br>
On 12-11-19 07:58 PM, Antonio Parrotta wrote:<br>
</div>
<blockquote
cite="mid:CAByPMPKrye2e_HiCQ7=KgTXUoECktdmH5ZzhMAxeW1M9Fe+k6Q@mail.gmail.com"
type="cite">Hi,
<div><br>
</div>
<div>I'm trying to merge MVC simple (<i><a moz-do-not-send="true"
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 moz-do-not-send="true"
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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@geoext.org">Users@geoext.org</a>
<a class="moz-txt-link-freetext" href="http://www.geoext.org/cgi-bin/mailman/listinfo/users">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Alexandre Dubé
Mapgears
<a class="moz-txt-link-abbreviated" href="http://www.mapgears.com">www.mapgears.com</a>
</pre>
</body>
</html>