diff --git a/lib/edit/offlineFeaturesManager.js b/lib/edit/offlineFeaturesManager.js index add10da..69a49e9 100644 --- a/lib/edit/offlineFeaturesManager.js +++ b/lib/edit/offlineFeaturesManager.js @@ -11,6 +11,7 @@ define([ "dojo/_base/array", "dojo/dom-attr", "dojo/dom-style", + "dojo/query", "esri/layers/GraphicsLayer", "esri/graphic", @@ -18,7 +19,7 @@ define([ "esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleFillSymbol"], function(editsStore, AttachmentsStore, - Evented,Deferred,all,declare,array,domAttr,domStyle, + Evented,Deferred,all,declare,array,domAttr,domStyle,query, GraphicsLayer,Graphic,SimpleMarkerSymbol,SimpleLineSymbol,SimpleFillSymbol) { return declare([Evented], @@ -239,6 +240,11 @@ define([ // and each input can contain multiple files BUT here we call the callback and // resolve the deferred with the FIRST of the files // In practice, popups only have one input, and it doesn't allow multiple files + + // replace the default URL that is set by attachmentEditor with the local file URL + var attachmentUrl = this._url.path + "/" + objectId + "/attachments/" + attachmentId; + var attachmentElement = query("[href=" + attachmentUrl + "]"); + attachmentElement.attr("href", file.url); } else { @@ -246,7 +252,7 @@ define([ errback && errback(returnValue); deferred.reject(returnValue); } - }); + }.bind(this)); },this); }.bind(this)); return deferred;