Popup Template works when the browser is open, but does not work after browser is refreshed

2982
8
Jump to solution
10-14-2015 03:33 PM
IanPeebles
Occasional Contributor III

I have an application that allows the user to click on a feature and a popup template appears. However, if I refresh the app, the popup quits working even though the feature layer displays.  If I refresh again, the popup template works again.  Also, if I open the browser then use the popup it works, then close the browser then re-open it works.  Refreshing seems to be the issue.  I do not have a lot of features displayed.

How can I get the popup to work after the app is refreshed in the browser each time?

Here is the configuration of my feature layer:

// Map Feature Layer ---------------------------------------------------------------------------------------------------------------------
publicartFL = new FeatureLayer("http://gis.edmondok.com/arcgis/rest/services/Parks/PublicArt/MapServer/0", {
   id: "PublicArt",
    mode: FeatureLayer.MODE_ONDEMAND,
    outFields: ["*"],
   infoTemplate: infoTemplate 
});
map.addLayer(publicartFL);

Here is a scenario:

1. Open the application, click on a feature and the popup template appears.

2. Refresh the app, features display, yet popup does not work.

3. Refresh the app again, the features display, then the popup works again.

I have also tried using the mode: FeatureLayer.MODE_SNAPSHOP, but I get the same results.

How can I get the popup to appear if a user were to refresh the application?  Has anyone else run into this issue?

Any advice or input is greatly appreciated.

0 Kudos
1 Solution

Accepted Solutions
IanPeebles
Occasional Contributor III

I have figured out a different solution.  I am now using the ArcGISDynamicMapService for using an Info Popup.  Caching the browser each time fixes the issue, but that is not reasonable for end users.

The dynamic map service shows up each time the browser window is refreshed.  Here is a code change I made:

var surveymonuments = new ArcGISDynamicMapServiceLayer("REST ENDPOINT", {

   id: "SurveyMonuments"

});

 

   // Set Info Template for Survey Monuments

   surveymonuments.setInfoTemplates({

      0: { infoTemplate: infoTemplate }

         });

   

    map.addLayer(surveymonuments);

I have the info template defined in the application.  Problem solved.

View solution in original post

8 Replies
RickeyFight
MVP Regular Contributor

Ian,

On step 2 of your scenario, what does your console log say when you try clicking on a feature?

IanPeebles
Occasional Contributor III

Rickey,

Here is the application:  http://gis.edmondok.com/surveymonuments

Here is what my console log is showing:

Error: Unable to draw graphic (null): Unable to complete operation.(…)

Can you see the graphic if you open the application? Open it, use the popup, then refresh the browser.

RickeyFight
MVP Regular Contributor

Ian,

I am getting the same result.

I do not get the same result if I refresh the cache every time.

IanPeebles
Occasional Contributor III

Rickey, is there something I can do to clear the cache when the browser is refreshed?

Notice how it is on, then off, then on again after refreshing?

0 Kudos
IanPeebles
Occasional Contributor III

I have figured out a different solution.  I am now using the ArcGISDynamicMapService for using an Info Popup.  Caching the browser each time fixes the issue, but that is not reasonable for end users.

The dynamic map service shows up each time the browser window is refreshed.  Here is a code change I made:

var surveymonuments = new ArcGISDynamicMapServiceLayer("REST ENDPOINT", {

   id: "SurveyMonuments"

});

 

   // Set Info Template for Survey Monuments

   surveymonuments.setInfoTemplates({

      0: { infoTemplate: infoTemplate }

         });

   

    map.addLayer(surveymonuments);

I have the info template defined in the application.  Problem solved.

RickeyFight
MVP Regular Contributor

Ian,

I am glad you were able to figure it out.

Don't forget to mark your answer correct.

IanPeebles
Occasional Contributor III

Thanks Rickey.  Still need to figure out feature layer drawing, but no need to use it if I can use the dynamic layer to perform the same function .

0 Kudos
CenterlineMapping
New Contributor III

Cool web app!

0 Kudos