Just tried with latest OpenLayers from master, and it works fine for me. Maybe you have stronger selector somewhere that takes precedence?
Andreas. On Tue, Feb 14, 2012 at 2:05 PM, [email protected] <[email protected]> wrote: > Hi, i tried int his way but it seem that it doesn't work. > Do you have any suggestions? > > Thanks > > Francesco > >>----Messaggio originale---- >>Da: [email protected] >>Data: 14/02/2012 12.46 >>A: "[email protected]"<[email protected]> >>Cc: <[email protected]> >>Ogg: Re: Re: [OpenLayers-Users] Hide Overlay Laben in OpenLayers.Control. > LayerSwitcher >> >>Oh no, I was hoping you had just added something like the following to >>your application css >> >>.olControlLayerSwitcher .dataLbl { >> display: none; >>} >> >>Andreas. >> >>On Tue, Feb 14, 2012 at 12:41 PM, [email protected] >><[email protected]> wrote: >>> Yes, you are right... >>> This is the procedure that i used: >>> >>> 1- I modified the file ../lib/OpenLayers/Control/LayerSwitcher.js in this > way: >>> >>> - I comment all the line that contain dataLbl : >>> >>> /** >>> * Property: dataLbl >>> * {DOMElement} >>> */ >>> //dataLbl: null, >>> ........ >>> >>> //this.dataLbl.style.display = > (containsOverlays) >>> ? "" : "none"; >>> ...... >>> >>> //this.dataLbl = document.createElement("div"); >>> //this.dataLbl.innerHTML = OpenLayers.i18n >>> ("Layers"); >>> //OpenLayers.Element.addClass(this.dataLbl, >>> "dataLbl"); >>> >>> ..... >>> >>> if (this.ascending) { >>> this.layersDiv. >>> appendChild(this.baseLbl); >>> this.layersDiv. >>> appendChild(this.baseLayersDiv); >>> //this.layersDiv. >>> appendChild(this.dataLbl); >>> this.layersDiv. >>> appendChild(this.dataLayersDiv); >>> } else { >>> //this.layersDiv. >>> appendChild(this.dataLbl); >>> this.layersDiv. >>> appendChild(this.dataLayersDiv); >>> this.layersDiv. >>> appendChild(this.baseLbl); >>> this.layersDiv. >>> appendChild(this.baseLayersDiv); >>> } >>> >>> after all i recompiled OpenLayers.js file in this way : >>> >>> ../OpenLayers-2.11/build# ./build.py full.cfg OpenLayers.js >>> >>> That's all ... There is anoter way to do that directly into the html file >>> after: >>> >>> map.addControl( new OpenLayers.Control.LayerSwitcher({ .... >>> >>> just add this line: >>> >>> document.getElementsByClassName("dataLbl")[0].innerHTML ="" >>> >>> That's all. >>> >>> Francesco Boccacci >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>>>----Messaggio originale---- >>>>Da: [email protected] >>>>Data: 14/02/2012 12.13 >>>>A: "[email protected]"<[email protected]> >>>>Cc: <[email protected]> >>>>Ogg: Re: [OpenLayers-Users] Hide Overlay Laben in OpenLayers.Control. >>> LayerSwitcher >>>> >>>>It would be good practice to summarize what was done to solve an >>>>issue, because for people finding this in the archive it is annoying >>>>to only find "I solved it..." without any hints on HOW. >>>> >>>>Andreas. >>>> >>>>On Tue, Feb 14, 2012 at 11:08 AM, [email protected] >>>><[email protected]> wrote: >>>>> Hi all, >>>>> i solved it.. >>>>> >>>>> Francesco >>>>> >>>>>>----Messaggio originale---- >>>>>>Da: [email protected] >>>>>>Data: 13/02/2012 21.37 >>>>>>A: <[email protected]> >>>>>>Ogg: [OpenLayers-Users] Hide Overlay Laben in OpenLayers.Control. >>>>> LayerSwitcher >>>>>> >>>>>>Hi all, >>>>>>i would like to hide the Overlay Label in my OpenLayers.Control. >>>>> LayerSwitcher. >>>>>>Is it possible? >>>>>>i tried in this way: >>>>>> >>>>>>map.addControl( new OpenLayers.Control.LayerSwitcher({ >>>>>> >>>>>> dataLbl : "", >>>>>> >>>>>> >>>>>>but it doesn't work. >>>>>> >>>>>>My html file i add : >>>>>><script type="text/javascript" src="OpenLayers-2.11/OpenLayers.js"> >>>>>>to read directly to the OpenLayer folder in localserver. >>>>>>I tried also to comment these lines in: >>>>>>../OpenLayers-2.11/lib/OpenLayers/Control/LayerSwitcher.js >>>>>> >>>>>> loadContents: function() { >>>>>> >>>>>> //configure main div >>>>>> >>>>>> OpenLayers.Event.observe(this.div, "mouseup", >>>>>> OpenLayers.Function.bindAsEventListener(this.mouseUp, this)); >>>>>> OpenLayers.Event.observe(this.div, "click", >>>>>> this.ignoreEvent); >>>>>> OpenLayers.Event.observe(this.div, "mousedown", >>>>>> OpenLayers.Function.bindAsEventListener(this.mouseDown, > this)); >>>>>> OpenLayers.Event.observe(this.div, "dblclick", this.ignoreEvent); >>>>>> >>>>>> // layers list div >>>>>> //this.layersDiv = document.createElement("div"); >>>>>> //this.layersDiv.id = this.id + "_layersDiv"; >>>>>> //OpenLayers.Element.addClass(this.layersDiv, "layersDiv"); >>>>>> >>>>>> this.baseLbl = document.createElement("div"); >>>>>> this.baseLbl.innerHTML = OpenLayers.i18n("Base Layer"); >>>>>> OpenLayers.Element.addClass(this.baseLbl, "baseLbl"); >>>>>> >>>>>> this.baseLayersDiv = document.createElement("div"); >>>>>> OpenLayers.Element.addClass(this.baseLayersDiv, "baseLayersDiv"); >>>>>> >>>>>> //this.dataLbl = document.createElement("div"); >>>>>> //this.dataLbl.innerHTML = OpenLayers.i18n("Overlay"); >>>>>> //this.dataLbl.innerHTML = "<u>"+this.getOverlaysTitle()+"</u>"; >>>>>> //OpenLayers.Element.addClass(this.dataLbl, "dataLbl"); >>>>>> >>>>>> //this.dataLayersDiv = document.createElement("div"); >>>>>> //OpenLayers.Element.addClass(this.dataLayersDiv, > "dataLayersDiv"); >>>>>> >>>>>> if (this.ascending) { >>>>>> this.layersDiv.appendChild(this.baseLbl); >>>>>> this.layersDiv.appendChild(this.baseLayersDiv); >>>>>> this.layersDiv.appendChild(this.dataLbl); >>>>>> this.layersDiv.appendChild(this.dataLayersDiv); >>>>>> } else { >>>>>> this.layersDiv.appendChild(this.dataLbl); >>>>>> this.layersDiv.appendChild(this.dataLayersDiv); >>>>>> this.layersDiv.appendChild(this.baseLbl); >>>>>> this.layersDiv.appendChild(this.baseLayersDiv); >>>>>> >>>>>>.. >>>>>>but it doesn't work. Any suggestion? >>>>>> >>>>>>Thanks >>>>>> >>>>>>Francesco >>>>>> >>>>>>_______________________________________________ >>>>>>Users mailing list >>>>>>[email protected] >>>>>>http://lists.osgeo.org/mailman/listinfo/openlayers-users >>>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> Users mailing list >>>>> [email protected] >>>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users >>>> >>>> >>>> >>>>-- >>>>Andreas Hocevar >>>>OpenGeo - http://opengeo.org/ >>>>Expert service straight from the developers. >>>> >>> >>> >> >> >> >>-- >>Andreas Hocevar >>OpenGeo - http://opengeo.org/ >>Expert service straight from the developers. >> > > -- Andreas Hocevar OpenGeo - http://opengeo.org/ Expert service straight from the developers. _______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
