On Sunday, June 13, 2010, Eric Lemoine <[email protected]> wrote: > On Saturday, June 12, 2010, Richard LEHAUT <[email protected]> wrote: >> >> >> >> >> >> >> >> Eric Lemoine a écrit : >> >> On Friday, June 11, 2010, Richard LEHAUT >> <[email protected]> <[email protected]> wrote: >> >> >> Eric Lemoine a écrit : >> >> Hi >> >> I'm not sure I understand your question. Why don't you use "Ortho", >> "Calvados 2001", and "Channel 2006" as the names of your OpenLayers >> layers? The legend panel will use these names as the labels. >> >> Cheers, >> >> >> >> Hi, >> >> There is a single layer openlayer, it's Ortho. >> 2001 Calvados, Orne, 2008, is information I want displayed under the layer >> name. To be more precise, it's the date of shooting aerial photography. The >> information at this time is recorded anywhere. >> >> I hope this is clearer. >> >> >> >> Yes, sorry I didn't understand you the first time. >> >> So I guess you'd like to use HTML (e.g. Ortho.<br>2001 Calvados.) in >> the layer's name and have GeoExt render this HTML for the layer >> labels. >> >> I haven't actually tested that myself, but looking at the code I think >> it won't work. This is because GeoExt.LayerLegend uses the "text" >> property as opposed to the "html" property when it creates >> Ext.form.Label objects. See [*]. I'm curious to know if we could use >> "html" instead of "text" in GeoExt. >> >> Cheers, >> >> [*] >> <http://trac.geoext.org/browser/core/trunk/geoext/lib/GeoExt/widgets/LayerLegend.js#L54> >> >> >> >> Hi >> >> I got the desired result, Following your instructions and this post >> (*). To test, I wrote the caption in red. >> What do you think of this method? There is two méthods modified, >> initComponent and Update >> >> (*) >> https://www.extjs.com/forum/showthread.php?72648-How-to-set-html-of-label >> Thank you for your help >> Richard LEHAUT >> >> Code >> /** private: method[initComponent] >> initComponent: function() { >> GeoExt.LayerLegend.superclass.initComponent.call(this); >> this.autoEl = {}; >> this.add({ >> xtype: "label", >> text: this.getLayerTitle(this.layerRecord), >> cls: 'x-form-item x-form-item-label' + >> (this.labelCls ? ' ' + this.labelCls : '') >> }); >> }, >> CORRECTION INTERPRETATION HTML DU TITLE >> */ >> >> initComponent: function() { >> GeoExt.LayerLegend.superclass.initComponent.call(this); >> this.autoEl = {}; >> var label = new Ext.form.Label({ >> text: 'Hello', >> cls: 'x-form-item x-form-item-label' + >> (this.labelCls ? ' ' + this.labelCls : '') >> }); >> label.setText('<span style="color: >> red;">'+this.getLayerTitle(this.layerRecord)+'</span>', false); >> this.add(label); >> }, >> >> /** private: method[update] >> * Updates the legend. >> update: function() { >> var title = '<span style="color: >> red;">'+this.getLayerTitle(Hmm... so setText can receive HTML strings. Then, >> I don't see why the > "text" property could not. What if you leave the GeoExt code > unmodified and use HTML in the layer name? > > new OpenLayers.Layer.WMS('<span style="color:red;">Ortho</span>', ...);
Actually it doesn't work. Feel free to create a trac ticket with a patch implementing your solution. Thanks, -- 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
