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();
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?
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.
//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; }
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=".........." />...
This works for us:In IE go to Tools>Internet Option, and in the General Tab click the Settings button against Browsing History. Then check the 'Every time I visit the webpage' option.Mark.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.