AnsweredAssumed Answered

Suspend map click event for identify when floating pane is open

Question asked by schlot on Jun 19, 2014
Latest reply on Jun 23, 2014 by schlot
I have a map click to do an identify defined initially.  I want to be able to let the user click on my chart button to open a floating pane where I will generate a chart.  While the floating pane is open, I want the click event to run my generate chart function for the selected polygon instead of my standard identify.  I have multiple years of data for each county I want to show, coming out of multiple layers in my service.  The data is gathered through another identify that looks at all layers and formats the data the way the chart needs it. That part is figured out, believe or not.  I'm stuck on managing my identify click handlers.

I've found several threads that discuss switching between the measure tools and identify, but the solution seems to be having a listener on the measure events.  Nothing in those solutions helps me with this situation.

I tried setting a variable when I defined the identify click event as

identifyHandler = map.on('click', identifyClickHandler);


I have a function to open the floating pane as
registry.byId('btnChart').on('click', function (){   idFromClick = false;   chartClick = true;   domConstruct.empty("chartDiv");   openFloatingPane('floater_chart');   makeCountyChartClickHandler = map.on( "click", chartCountyByMapClick);         });


How do I get rid of identifyHandler?  At what point do I turn it back on again?  I'm not sure how what the event is for the floatingPane getting closed.  All the examples I found are still based on dojo.connect and dojo.disconnect. 

I also need to clear out the div that's in my floating pane in preparation to creating a new chart.  I'm trying to use
domConstruct.empty("chartDiv"); 


Since my chart div is in my floating pane, it looks like the pane is getting destroyed, not closed, so I'm not sure when to empty it.

The other thing that is happening is that the chart works OK the first time, but when I click a 2nd time on the same or different county, it's loading my chart over the top of it self multiple times.  I think it's doing it because the identify is firing more than once.  I'm sure it's because I haven't straightened out my click events yet, but it does seem wierd.

Here's my best attempt to post my example:
http://jsfiddle.net/schlot/HPDP7/

Outcomes