Select to view content in your preferred language

Feature Layer Refresh not working in IE

8945
15
07-27-2010 05:15 AM
RaviKonaparthi
Deactivated User
Hi All,

When i update any feature the REST endpoint is updated but the featurelayer which is already present on the map is not getting updated. I tried featureLayer.refresh(), but this works fine in firefox but dosen't work in IE. Can anyone help me on some workarounds if any?

Regards,
Ravi.
0 Kudos
15 Replies
OzanEmem
Deactivated User
UPDATE to previous message;

I had massive problems with IE recently aswell. So here just a short hint:
....
2. avoid to use this tag or similar on top: <meta http-equiv="X-UA-Compatible" content=".........." />
...


is seemed to be the solutions to this problem even without meta elements.
0 Kudos
DimitarKolev
Emerging Contributor
This worked for me:
http://forums.arcgis.com/threads/54774-Disable-Caching-on-FeatureLayer.refresh()?p=265103&viewfull=1...

Modify the request with a preventCache option before it is sent to the server.
Set this up in your initialization method.

Works for ArcGIS 10.1 and IE9
Used AcrGIS JavaScript 3.3 API.

            //modify the request with a preventCache option before it is sent to the server
            // so the feature layer is not cached in the browser
            esri.setRequestPreCallback(function (ioArgs) {
                try {
                    if (ioArgs.url.indexOf("FeatureServer") > -1 &&
                    ioArgs.content.returnGeometry == true) {
                        ioArgs.preventCache = true;
                    }
                    return ioArgs;

                } catch (e) {
                    console.log(e.toString());
                    return ioArgs;
                } 


Hope it heps:)
0 Kudos
Mindaugas_ižas
Emerging Contributor
I had this problem for a very long time, but it looks that managed to find the solutions.
It is only if you use proxy page.
Just add
response.setHeader("Cache-Control","no-cache");
response.setHeader("Pragma","no-cache");
response.setDateHeader ("Expires", 0);
to your proxy.jsp and all the requests will not be cached.
I am using JSAPI 2.8 and server 10.0

Hope this helps
0 Kudos
AshishChoure
Deactivated User

I am facing similar issue, when i add a feature on layer and call layer.refresh() it doesn't refresh the layer and show the newly added feature.Also i don't see any request fired when layer.refresh is called.

Browser: Internet Explorer 9

OS: Windows 7

JavaScript API: 3.13

Please let me know if anyone has any workarounds to resolve the issue.

Thanks in Advance.

0 Kudos
AshishChoure
Deactivated User

I investigated the issue further and found that, if layer is hosted on AGOL the newly added feature is not shown on map after refreshing the layer. But it does work well when layer is sourced from ArcGIS server.

Does anyone saw the same behavior?

AndrewMurdoch
Regular Contributor

I'm also seeing the same behavior with updates to Feature Layers hosted in an organizational AGOL account.  When the Feature Layer applyEdits command is updated, the REST endpoint data store is updated, but the Feature Layer on the map does not immediately update its renderer (I'm changing a unique value renderer using a domain list in the attribute inspector).  When I zoom in and zoom out on the map, the renderer and layer DO refresh, but I really don't want to have to refresh all the layers and tiles in the map just to change the renderer and data for a single Feature Layer...

This is all using JSAPI 3.14 (in Web App Builder Developer edition 1.2) and ESRI AGOL hosted Feature Service / Feature Layers.

Would love to know if there is a graceful work-around...

[EDIT]

Turns out the features were being updated, but I needed to call the .refresh() method on the AGOL web map Feature Layer after the deferred object from the .applyEdits method is returned.  The following code worked for my particular situation (updating attributes on a custom generated FeatureLayer but displaying the graphics in the Map from an AGOL web map FeatureLayer with editing turned off):

                          var saveButton = new Button({
                              label: "Save",
                              onClick: function () {
                                 updateFeature.getLayer().applyEdits(null, [updateFeature], null).then(function(){

                                // this block is to check for "duplicate" layers that reference the same URL REST endpoint but use different symbology renderers
                                      dojo.forEach(thisWidget._operationalLayers, function (oLayer) {
                                          if (oLayer.url == webMapGLayer.url) {
                                              queryString = "$.operationalLayers[?id=$1]";
                                              var webMapLayerObject = jsonQuery(queryString, theMap.webMapResponse.itemInfo.itemData, oLayer.id);
                                              webMapLayerObject[0].layerObject.refresh();
                                          }
                                      });
                                  });                                                                                                 }
                          });
                          saveButton.startup();
0 Kudos