I am trying to display attribute infos and attachment in popup window. It can be quite good handled by code selected as correct answer here (https://geonet.esri.com/thread/159806). Basically you create two event handlers for “click” and “query-attachment-infos-complete“ and in second one you set content of infoTemplate.

The problem with this approach is somehow „cosmetical“, but I would like to solve it. If you click two features that are close enough to each other you get a popup with label like „1/2“ and arrow that is supposed to switch popup conten to feature „2/2“. The problem is that on feature 2/2 the content (attachement url, or thumbnail) is the same as for feature 1/2 . It is probably because in handler for “query-attachment-infos-complete“ you set infoTemplate.content for one feature and that infoTemplate is used for second feature as well.

So I am wondering if this could not be better solved with similar approach as in the tutorial here: https://developers.arcgis.com/javascript/jshelp/intro_formatinfowindow.html (at the bottom of the page, after Deferred Object bullet). In this approach you set content for infoWindow by function, let’s call it getTextContent(graphic). And inside this function you can run method featureLayer. queryAttachmentInfos(OBJECTID) which return value is deferred object. So you can implement callback function and get attachement url. I am just totally lame to get attachement url from that callback function into return variable for getTextContent function. The scratch version is like this:

function getTextContent(graphic)
    var deferred = editLayer.queryAttachmentInfos(
                       function (attachemntInfos)
                           var attachmentUrl = attachemntInfos[0].url;
                           return attachmentUrl;

    //I wish this would be attachmentUrl...
    return ???attachmentUrl 

  • Well I guess I just got talent to ask "answerless" questions... – makak Jul 31 '15 at 4:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.