Hi all,
I'm trying to get a tree panel with some layers, and I want each LayerNode
to show a different custom icon. I'm trying it in various ways:
WAY 1 - Adding each layerNode one by one, like this:
*var layerNode1 = new GeoExt.tree.LayerNode({
// ...
layer: layer1,
iconCls: 'myIconCls_1',
// ...
});
var layerNode2 = // ... similar code to layerNode1
var layerNode3 = // ...
// ...
var panel = new Ext.tree.TreePanel({
root: {
children: [layerNode1, layerNode2, // ...]
},
// ...
});*
But this way the icon still remains the default one.
WAY 2 - Adding all layers at the same time using LayerContainer, like this:
*
var layerList = new GeoExt.tree.LayerContainer({
text: 'Layer container',
leaf: false,
expanded: true,
loader: {
baseAttrs: {
iconCls: 'myClass'
}
}
});*
This works, but this way, of course, sets the same icon to every layerNode
there.
As a temporal solution, I've patched the LayerLoader's addLayerNode method,
leaving it like this:
*// ...
var child = this.createNode({
nodeType: 'gx_layer',
layer: layerRecord.get("layer"),
layerStore: this.store,
+++ iconCls:layerRecord.get("layer").iconCls
});
// ...*
This way, setting an iconCls property in the (OpenLayers) Layer object
works.
My question is: is there any other way to do this? Both of them, setting
different custom icons to layerNodes when adding them individually and when
adding them using LayerContainer with filters.
Thank you in advance,
Best regards,
Xurxo Méndez Pérez
_______________________________________________
Dev mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/dev