[OpenLayers-Users] wmsGetFeatureInfo deactivate button

vrbikdan vrbikdan at gmail.com
Fri Apr 6 04:50:22 EDT 2012


Hi,
I have really stupid question :) I have wmsGetFeatureInfo in my map and I
want to add checkbox for enable and disable this info. Enable works, but
disable don't and I don't know why. Maybe it could be better seen in code:

function onclck(){
	    info = new OpenLayers.Control.WMSGetFeatureInfo({
            url: "http://192.168.1.50:8080/geoserver/zk/wms", 
            title: 'Identify features by clicking',
            queryVisible: true,
	    eventListeners: {			
                getfeatureinfo: function(event) {
					 for (var i = 0; i < event.features.length; i++) {
                       feature = event.features[i];
                       var attributes = feature.attributes;
					   x=attributes.fid;
					   for(var key in layers){
					   layers[key].mergeNewParams({env:"sel:"+x+";opacita:0.5"});}}}}});
			map.addControl(info);
	
             if
(document.forms.seznamVrstev.infoButt.checked){info.activate();}
             else{info.deactivate();}
}

This function I call on checkbox onclick. If I set info.deactivate(); out of
if/else it works, but I need to deactivate when is checkbox unchecked. And
when I try to set alerts in if/else, it works to, so I can't figure it out,
why deactivate doesn't work.

Is something I forgot? Thanks for help
Dan

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/wmsGetFeatureInfo-deactivate-button-tp4692153p4692153.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list