How to toggle Popup functionality?

1373
4
10-19-2013 07:47 AM
by Anonymous User
Not applicable
Original User: Schlomm

Hello,
How it's possible to toggle the popup functionality? Ideally by pressing a button or using a checkbox.

My webapp contains an editor and the option to click on features to get further information.
The problem is: If the user wants to add new features by clicking on the map, the popup pops out and gives information about the underlying area, which has the defined popup.
One example: http://jsfiddle.net/84vvR/

I've tried to implement a workaround with dojo.connect and a clickHandler or onClick like (button dojoType=�?�dijit.form.Button�?� onClick=�?�....(),...();�?�>Disable Popup Function</button), but I haven't manged it 😞
Would be awesome if there's somebody who can help me.

Thanks!
0 Kudos
4 Replies
DominikSchlarmann
Occasional Contributor
Any ideas?
Until now I've used the workaround of creating another map without the editor option, but of course it would be much more cooler to have only one map.

I also would like to use some other fuctions like the Drawing toolbar or Buffering a point but all of these uses the onclick option.

The best perfect solution would be, to create some buttons, to enable/disable certain functionalities.
Like a button for toggling Editor on/off, a button for toggling popup functionality on/off/, a button for drawing and a button for buffering a point.
0 Kudos
DominikSchlarmann
Occasional Contributor
Sorry for pushing, but maybe there's someone around, who haven't seen it 😉
Cheerio,
Dominik
0 Kudos
by Anonymous User
Not applicable
Original User: manish_patel

Hi Dominik,

You can try to use the dojo.disconnect to disable the pop up window.

for example:

var popupOnclickEventHandler;  //global variable.


use the below code to assign:

popupOnclickEventHandler = dojo.connect(map,"click",functionname);

when you want to disable the event

dojo.disconnect(popupOnclickEventHandler);

and attach a new event as required.

Hope this helps.

Regards,
Manish
0 Kudos
DominikSchlarmann
Occasional Contributor
Dear Manishkumar,
Thanks for your answer. Quite useful, but although my problem is the function part. In my case, I just use the popup functionality and not an identify method.
This is a example ( http://jsfiddle.net/9kt2j/ ), which shows the problem really well. If you want to add new feature with enabled LandZones Layer, the feature won't add to the map, but you get an information popup (although a feature should be added).

If that's not asking too much, you could probably edit the jsfiddle? Would be awesome to be able to toggle the popup functionality...

Cheerio,
Dominik


The code, which enables the popup is:

var popup = Popup({
    titleInBody: true,
    isEditable: true,
    pagingControls: true
},domConstruct.create("div"));


var template = new PopupTemplate({
    title: "Landzones",
    description: "<b>Zoning is the following: {ZONING_NAME} with the code {ZONING_CODE}",
    fieldInfos: [{ //define field infos so we can specify an alias
      fieldName: "ZONING_NAME",
      label: "ZONING NAME"
     },{
     fieldName: "ZONING_CODE",
     label: "ZONING CODE"
     },{
     fieldName: "ZONING_TYPE",
     label: "ZONING TYPE"
     }]
});

Landzones = new esri.layers.FeatureLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Louisville/LOJIC_LandRecords_Louisville/MapServer/2",{
   mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
   outFields: ["*"],
   infoTemplate:template
});
0 Kudos