Julien, tried but same result. for some reason the update of layerstore is not propagated to treestore<div>Thanks<br clear="all"><div>- Antonio</div>
<br><br><div class="gmail_quote">On 25 January 2013 16:51, Julien-Samuel Lacroix <span dir="ltr"><<a href="mailto:jlacroix@mapgears.com" target="_blank">jlacroix@mapgears.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I noticed your LayerStore is on autoload:false<br>
<br>
Did you try to set it to true?<br>
<br>
Julien<br>
<div><div class="h5"><br>
<br>
On 13-01-25 10:35 AM, Antonio Parrotta wrote:<br>
> Hi,<br>
><br>
> I'm trying to make an MVC app with a panel that contains a LayerTree<br>
> using EXTJS4 and GeoExt2.<br>
><br>
> Basically the problem is that the layertree needs to have the layer<br>
> store available on init but data are actually not ready, so layer tree<br>
> can be there before the map (or layer store) is available. The result of<br>
> this is that layers are not displayed in the tree. I tried to reload the<br>
> stores without any success. Do you have any hint?<br>
><br>
> Thanks a lot<br>
><br>
> I have then a<br>
><br>
> Ext.define('Pandora.view.LayersTree', {<br>
> // Ext.panel.Panel-specific options:<br>
> extend: 'GeoExt.tree.Panel',<br>
> store: 'LayersTree',<br>
> .....<br>
><br>
><br>
> then<br>
> Ext.define('Pandora.store.LayersTree', {<br>
> extend: 'Ext.data.TreeStore',<br>
> model: 'GeoExt.data.LayerTreeModel',<br>
><br>
> root: {<br>
> expanded: true,<br>
> children: [{<br>
> plugins: [{<br>
> ptype: 'gx_layercontainer',<br>
> loader: {<br>
> store: Ext.data.StoreManager.lookup('LayersMap'),//map.layers,<br>
> createNode: function(attr) {<br>
> // add a WMS legend to each node created<br>
> if(!(attr.layer instanceof OpenLayers.Layer.OSM || attr.layer instanceof<br>
> OpenLayers.Layer.Vector))<br>
> {<br>
> attr.component = {<br>
> xtype: "gx_wmslegend",<br>
> layerRecord: mapPanel.layers.getByLayer(attr.layer),<br>
> showTitle: false,<br>
> // custom class for css positioning<br>
> // see tree-legend.html<br>
> cls: "legend"<br>
> };<br>
> };<br>
> return GeoExt.tree.LayerLoader.prototype.createNode.call(this, attr);<br>
> }<br>
><br>
> and the layerstore<br>
><br>
> Ext.define('Pandora.store.LayersMap', {<br>
> extend: 'GeoExt.data.LayerStore',<br>
> autoload : false<br>
><br>
> and finally<br>
><br>
> in the map I simply do<br>
><br>
> store: 'LayersMap',<br>
> ...<br>
> Ext.data.StoreManager.lookup(this.store).bind(map);<br>
><br>
><br>
><br>
><br>
> - Antonio<br>
> il<br>
</div></div>> *articolo*: /il, la, le, i, lo, l ', gli, lo stesso/<br>
<div class="im HOEnZb">><br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@geoext.org">Users@geoext.org</a><br>
> <a href="http://www.geoext.org/cgi-bin/mailman/listinfo/users" target="_blank">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a><br>
><br>
<br>
</div><span class="HOEnZb"><font color="#888888">--<br>
Julien-Samuel Lacroix<br>
Mapgears<br>
<a href="http://www.mapgears.com/" target="_blank">http://www.mapgears.com/</a><br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@geoext.org">Users@geoext.org</a><br>
<a href="http://www.geoext.org/cgi-bin/mailman/listinfo/users" target="_blank">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a><br>
</div></div></blockquote></div><br></div>