Hi, On May 12, 2010, at 09:41 , Eric Lemoine wrote:
> On Wed, May 12, 2010 at 7:50 AM, Andreas Hocevar <[email protected]> wrote: >> Ext tree loaders are pretty extensible, and the loaders we have are no >> exception. >> >> The most elegant way, as Eric already pointed out, is to store the href >> somewhere, e.g. in the LayerStore. But there is no need to override a >> constructor or render method. The loader's createNode method is the one >> exposed to the API, and this is what you should override. See >> http://www.extjs.com/deploy/dev/docs/?class=Ext.tree.TreeLoader and look for >> the createNode method for an example. > > Your solution is indeed better. Thanks Andreas. > > One issue is that createNode receives a layer as opposed to a layer > record, so when overriding createNode one will need to find the layer > record corresponding to the layer. We could change the code so > createNode receives a layer record. We could also change LayerNode so > it can be configured with a layer record; currently the "layer" option > can reference a layer or a layer name, so we could extend this so it > can also reference a layer record. Why so complicated? We have a LayerStore::getByLayer method already. So the createNode method could look like this: var myLoader = GeoExt.tree.LayerLoader({ createNode: function(attr) { attr.href = attr.store.getByLayer(attr.layer).get("href"); GeoExt.tree.LayerLoader.prototype.createNode.call(this, attr); } // ... }); Regards, Andreas. > > Cheers, > > -- > Eric Lemoine > > Camptocamp France SAS > Savoie Technolac, BP 352 > 73377 Le Bourget du Lac, Cedex > > Tel : 00 33 4 79 44 44 96 > Mail : [email protected] > http://www.camptocamp.com > _______________________________________________ > Users mailing list > [email protected] > http://www.geoext.org/cgi-bin/mailman/listinfo/users -- Andreas Hocevar OpenGeo - http://opengeo.org/ Expert service straight from the developers. _______________________________________________ Users mailing list [email protected] http://www.geoext.org/cgi-bin/mailman/listinfo/users
