I am trying to merge two ArcGIS JS API examples: Feature Layer with Popup and Query Related Records. The idea I have in mind is clicking on a country feature, retrieve all related records from a service (already prepared for relationship queries) and present those text records inside a Popup (esri.dijit.Popup).
I was interested in doing this exercise, because I like the way this Popup presents multiple results for a feature, by paging them as you can see in the first link when clicking on a tree. And it was a good match for my application with Relationship Queries. So far, I have most of the functionality already prepared and I can see the related records retrieved from the services in my firebug console. Good news.
My problem comes when I have to put those records in the Dojo Popup: The example shows that adding features to the Popup is as "simple" as using the setFeatures(features) method. This method receives either an array of Deferreds or an array of Features. In my case, I have both of them available.
I get the results like this and add it to the popup on map.infoWindow parameter:
mydeferred = featureLayer.queryRelatedFeatures(relatedTopsQuery, function(relatedRecords) {var fset = relatedRecords[res.attributes['OBJECTID']];var items = dojo.map(fset.features, function(feature) { feature.attributes.DateStart = Date(feature.attributes.DateStart).toLocaleString(); feature.attributes.DateEnd = Date(feature.attributes.DateEnd).toLocaleString(); feature.setGeometry(evt.mapPoint); return feature.attributes;}); map.infoWindow.setFeatures(fset.features);map.infoWindow.show(evt.mapPoint);But, no matter if I pass to setFeatures a Deferred or a Feature array, that my output is the following one:
Does anyone detect the problem or the bug? I think that the problem might be related with the DOM structure of the features, because if you see the image attached, the function knows the size of the array of features, but does not display any of the related records. It is important to highlight that:
Maybe is it a bug? How should I proceed to report it?
أكثر...
I was interested in doing this exercise, because I like the way this Popup presents multiple results for a feature, by paging them as you can see in the first link when clicking on a tree. And it was a good match for my application with Relationship Queries. So far, I have most of the functionality already prepared and I can see the related records retrieved from the services in my firebug console. Good news.
My problem comes when I have to put those records in the Dojo Popup: The example shows that adding features to the Popup is as "simple" as using the setFeatures(features) method. This method receives either an array of Deferreds or an array of Features. In my case, I have both of them available.
I get the results like this and add it to the popup on map.infoWindow parameter:
mydeferred = featureLayer.queryRelatedFeatures(relatedTopsQuery, function(relatedRecords) {var fset = relatedRecords[res.attributes['OBJECTID']];var items = dojo.map(fset.features, function(feature) { feature.attributes.DateStart = Date(feature.attributes.DateStart).toLocaleString(); feature.attributes.DateEnd = Date(feature.attributes.DateEnd).toLocaleString(); feature.setGeometry(evt.mapPoint); return feature.attributes;}); map.infoWindow.setFeatures(fset.features);map.infoWindow.show(evt.mapPoint);But, no matter if I pass to setFeatures a Deferred or a Feature array, that my output is the following one:
Does anyone detect the problem or the bug? I think that the problem might be related with the DOM structure of the features, because if you see the image attached, the function knows the size of the array of features, but does not display any of the related records. It is important to highlight that:
- I had to manually add the geometry field to the features, maybe any other required parameter is missing and that is why the popup is showing nothing. Does it make sense?
- At this moment, the info template function getTextContent() returns a string "Hello world", but it is not appearing in the popup.
Maybe is it a bug? How should I proceed to report it?
أكثر...