I'm trying to display identify results in a PopupMobile:
addResults : function (evt, lo, results) { | ||
mvMapProperties.map.graphics.clear(); |
var s = '<table>'; |
var feature = results.feature; |
for (var j=0; j<lo.dataRenderer.columns.length; j++) { | ||||
var col = lo.dataRenderer.columns |
for (var attr in feature.attributes) { | |||||||
if (col === attr) { | |||||||
if (col === "STATION_NAME") { | |||||||
s += '<td style="font-size:14px; font-weight:bold;">' + feature.attributes[attr] + '</td></tr>' | |||||||
s += '<tr><td style="font-size:12px;">' + ghcnDailyMenu.currLabel + '</td></tr>'; | |||||||
s += '<tr><td style="font-size:12px;">' + ghcnDailyMenu.currLabelDate + '</td></tr>'; | |||||||
s += '<tr><td style="font-size:12px;"><b>'; | |||||||
} else { | |||||||
s += feature.attributes[attr]; | |||||||
} | |||||||
if (col === "METRIC" && ghcnDailyMenu.isTemp) s += " °C</b> / <b>"; | |||||||
if (col === "METRIC" && !ghcnDailyMenu.isTemp) s += " mm.</b> / <b>"; | |||||||
if (col === "IMPERIAL" && ghcnDailyMenu.isTemp) s += " °F</b>"; | |||||||
if (col === "IMPERIAL" && !ghcnDailyMenu.isTemp) s += " in.C</b>"; | |||||||
break; | |||||||
} | |||||||
} | |||||||
} | |||||||
mvMapProperties.map.infoWindow.setFeatures([feature]); | |||||||
} | |||||||
s += "</td></tr></table>\n\r"; |
mvMapProperties.map.infoWindow.setTitle("Test"); | ||
mvMapProperties.map.infoWindow.setContent(s); | ||
mvMapProperties.map.infoWindow.show(evt.mapPoint, mvMapProperties.map.getInfoWindowAnchor(evt.screenPoint)); | ||
} |
On the first identify, when I try to look at the results, the content is empty (attached images 1 and 2). When I click a second time, the data will show up (attached image 3)
Solved! Go to Solution.
Glen,
I think perhaps in your app you may be overwriting the feature content in the popup with the content you define in setContent but can't say for sure what the issue is based on the code snippet you provided. So I thought I'd provide a link to a simple demo app that shows how to display identify results using the mobile popup.
Glen,
I think perhaps in your app you may be overwriting the feature content in the popup with the content you define in setContent but can't say for sure what the issue is based on the code snippet you provided. So I thought I'd provide a link to a simple demo app that shows how to display identify results using the mobile popup.
Thanks Kelly, that helped me solve it. I think that the InfoWindow
expecting an array of features and the identify response being an array
of identify result objects was tripping me up.
Glen