[Users] Turning treepanel legend items into hyperlinks.
Andreas Hocevar
ahocevar at opengeo.org
Wed May 12 10:10:37 CEST 2010
Hi,
On May 12, 2010, at 09:41 , Eric Lemoine wrote:
> On Wed, May 12, 2010 at 7:50 AM, Andreas Hocevar <ahocevar at opengeo.org> 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 : eric.lemoine at camptocamp.com
> http://www.camptocamp.com
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list