1) Popup for search results not working and 2) ContantPane data flashes as map loads

946
7
05-08-2014 04:07 AM
LauraTeisl
New Contributor
I have a couple of nagging questions based on the code at www.laurateisl.com.
 
1) I can't seem to get my popup to work for the result of a search.   

2) As my map/Web site loads, some ContentPane data flashes in the top left hand side of the webpage, then disappears.  The code then correctly loads. 

Any suggestions for correcting either of this matters?   

Any help is appreciated.
Thanks,
Laura
0 Kudos
7 Replies
ChipHankley1
New Contributor III

2) As my map/Web site loads, some ContentPane data flashes in the top left hand side of the webpage, then disappears.  The code then correctly loads.


Check out this write up about using loading overlays.  Basically, you are seeing the elements being rendered before they are dojo-ified and placed in the right spot on the page.  A loading overlay allows you to hide this distracting stuff until the page loads.
0 Kudos
LauraTeisl
New Contributor
Chip,

That worked nicely.  Thank you.  Nice reference.
Laura
0 Kudos
ChipHankley1
New Contributor III
1) I can't seem to get my popup to work for the result of a search.


Did you fix this? I'm not sure what's not working on your site... I get the results (in the table below the map) for a search.  If it's not working, can you provide a more detailed description of what you expect?
0 Kudos
LauraTeisl
New Contributor
Thanks for asking.

I did not fix the popup problem. 

My popups work except in this situation:  If I perform a search (from the accordion container on the right) and obtain a result (a red point), when I click on the red point (the result of my search), I do not get a popup.

I appreciate any input.
Laura
0 Kudos
ChipHankley1
New Contributor III
Laura -

I looked at this a bit...

When you click on the results of a query (the red dot) you are clicking on a graphics element in the map.graphics object.  I think that the featurelayers underneath the graphic object aren't responding... I'm guessing that the way you have things built, the map responds to the FIRST object that is clicked on.

If you inspect the map graphics object (map.graphics.graphics.attributes) you will see that the attributes of the original feature are retained.

I'm not sure what the best way to go about dumping this content into a popup is.  I tried assigning your InfoTemplate objects to the graphic object, but that didn't seem to work... although I didn't play with it that long.  I did this in the showResults() function by adding this line:

graphic.infoTemplate=template;


...right after graphic.setSymbol(symbol);

If you could get that to work, then that would probably fit with your overall design better.  Outside of that, you may have to build a separate popup element to deal with the graphic object.

In lieu of that, you may be able to construct some logic that directs an on-click event to ignore the map.graphics and go on to the pop ups associated with your feature layers.
0 Kudos
LauraTeisl
New Contributor
Thanks for spending time on this problem.  Much appreciated.  I will try your suggestion.

Laura
0 Kudos
GyeyoungChoi
New Contributor II
Laura -

I looked at this a bit...

When you click on the results of a query (the red dot) you are clicking on a graphics element in the map.graphics object.  I think that the featurelayers underneath the graphic object aren't responding... I'm guessing that the way you have things built, the map responds to the FIRST object that is clicked on.

If you inspect the map graphics object (map.graphics.graphics.attributes) you will see that the attributes of the original feature are retained.

I'm not sure what the best way to go about dumping this content into a popup is.  I tried assigning your InfoTemplate objects to the graphic object, but that didn't seem to work... although I didn't play with it that long.  I did this in the showResults() function by adding this line:

graphic.infoTemplate=template;


...right after graphic.setSymbol(symbol);

If you could get that to work, then that would probably fit with your overall design better.  Outside of that, you may have to build a separate popup element to deal with the graphic object.

In lieu of that, you may be able to construct some logic that directs an on-click event to ignore the map.graphics and go on to the pop ups associated with your feature layers.


I had same prob but unfortunately didn't work

graphic.infoTemplate=template;


...right after graphic.setSymbol(symbol);

however thanks!
0 Kudos