[Commits] r1650 - core/trunk/geoext/lib/GeoExt/widgets
commits at geoext.org
commits at geoext.org
Wed Jan 6 20:04:06 CET 2010
Author: tschaub
Date: 2010-01-06 20:04:06 +0100 (Wed, 06 Jan 2010)
New Revision: 1650
Modified:
core/trunk/geoext/lib/GeoExt/widgets/LegendPanel.js
Log:
Making it so the legend panel generates an id unique to the panel/layer combo for each layer legend that it creates. r=ahocevar (closes #193)
Modified: core/trunk/geoext/lib/GeoExt/widgets/LegendPanel.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/widgets/LegendPanel.js 2010-01-06 08:20:12 UTC (rev 1649)
+++ core/trunk/geoext/lib/GeoExt/widgets/LegendPanel.js 2010-01-06 19:04:06 UTC (rev 1650)
@@ -118,6 +118,16 @@
}
return panelIndex;
},
+
+ /** private: method[getIdForLayer]
+ * :arg layer: ``OpenLayers.Layer``
+ * :returns: ``String``
+ *
+ * Generate an element id that is unique to this panel/layer combo.
+ */
+ getIdForLayer: function(layer) {
+ return this.id + "-" + layer.id;
+ },
/** private: method[onStoreUpdate]
* Update a layer within the legend panel. Gets called when the store
@@ -132,7 +142,7 @@
*/
onStoreUpdate: function(store, record, operation) {
var layer = record.get('layer');
- var legend = this.items ? this.getComponent(layer.id) : null;
+ var legend = this.items ? this.getComponent(this.getIdForLayer(layer)) : null;
if (legend) {
legend.setVisible(layer.getVisibility() && layer.inRange &&
layer.displayInLayerSwitcher && !record.get('hideInLegend'));
@@ -176,7 +186,7 @@
* store to remove.
*/
removeLegend: function(record) {
- var legend = this.getComponent(record.get('layer').id);
+ var legend = this.getComponent(this.getIdForLayer(record.get('layer')));
if (legend) {
this.remove(legend, true);
this.doLayout();
@@ -218,7 +228,7 @@
types.length > 0) {
this.insert(index, {
xtype: types[0],
- id: layer.id,
+ id: this.getIdForLayer(layer),
layerRecord: record,
hidden: !(layer.getVisibility() && layer.inRange)
});
More information about the Commits
mailing list