[Users] MVC with LayerTree
Antonio Parrotta
antonioparrotta at gmail.com
Fri Jan 25 17:08:03 CET 2013
Julien, tried but same result. for some reason the update of layerstore is
not propagated to treestore
Thanks
- Antonio
On 25 January 2013 16:51, Julien-Samuel Lacroix <jlacroix at mapgears.com>wrote:
> Hi,
>
> I noticed your LayerStore is on autoload:false
>
> Did you try to set it to true?
>
> Julien
>
>
> On 13-01-25 10:35 AM, Antonio Parrotta wrote:
> > Hi,
> >
> > I'm trying to make an MVC app with a panel that contains a LayerTree
> > using EXTJS4 and GeoExt2.
> >
> > Basically the problem is that the layertree needs to have the layer
> > store available on init but data are actually not ready, so layer tree
> > can be there before the map (or layer store) is available. The result of
> > this is that layers are not displayed in the tree. I tried to reload the
> > stores without any success. Do you have any hint?
> >
> > Thanks a lot
> >
> > I have then a
> >
> > Ext.define('Pandora.view.LayersTree', {
> > // Ext.panel.Panel-specific options:
> > extend: 'GeoExt.tree.Panel',
> > store: 'LayersTree',
> > .....
> >
> >
> > then
> > Ext.define('Pandora.store.LayersTree', {
> > extend: 'Ext.data.TreeStore',
> > model: 'GeoExt.data.LayerTreeModel',
> >
> > root: {
> > expanded: true,
> > children: [{
> > plugins: [{
> > ptype: 'gx_layercontainer',
> > loader: {
> > store: Ext.data.StoreManager.lookup('LayersMap'),//map.layers,
> > createNode: function(attr) {
> > // add a WMS legend to each node created
> > if(!(attr.layer instanceof OpenLayers.Layer.OSM || attr.layer instanceof
> > OpenLayers.Layer.Vector))
> > {
> > attr.component = {
> > xtype: "gx_wmslegend",
> > layerRecord: mapPanel.layers.getByLayer(attr.layer),
> > showTitle: false,
> > // custom class for css positioning
> > // see tree-legend.html
> > cls: "legend"
> > };
> > };
> > return GeoExt.tree.LayerLoader.prototype.createNode.call(this, attr);
> > }
> >
> > and the layerstore
> >
> > Ext.define('Pandora.store.LayersMap', {
> > extend: 'GeoExt.data.LayerStore',
> > autoload : false
> >
> > and finally
> >
> > in the map I simply do
> >
> > store: 'LayersMap',
> > ...
> > Ext.data.StoreManager.lookup(this.store).bind(map);
> >
> >
> >
> >
> > - Antonio
> > il
> > *articolo*: /il, la, le, i, lo, l ', gli, lo stesso/
> >
> >
> > _______________________________________________
> > Users mailing list
> > Users at geoext.org
> > http://www.geoext.org/cgi-bin/mailman/listinfo/users
> >
>
> --
> Julien-Samuel Lacroix
> Mapgears
> http://www.mapgears.com/
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20130125/0ab8123c/attachment.htm
More information about the Users
mailing list