I am trying to display attribute infos and attachment in popup
window. It can be quite good handled by code selected as correct answer
Basically you create two event handlers for “click” and
“query-attachment-infos-complete“ and in second one you set content of
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:
(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:
var deferred = editLayer.queryAttachmentInfos(
var attachmentUrl = attachemntInfos.url;
//I wish this would be attachmentUrl...
Any help,idea, comment would by very appreciated.