Hi Zhu,I changed the line as you suggested to:Change graphic.attributes.OBJECTID === foundItem[0] to graphic.attributes.OBJECTID === foundItem The map does not recenter where the user clicks???It does not move or recenter???
Hi,I want the map to centre the map, when the user clicks the map.I have added a line to center the map, is not working??The code is below, any suggestions???>>>>>>>>>>>>>>>>>>>>>>>>>>>//Zoom to the parcel when the user clicks a rowfunction onRowClickHandler(evt) { var foundItem = grid.getItem(evt.rowIndex).obj_ID; var selectedItem; dojo.forEach(map.graphics.graphics, function(graphic) { if((graphic.attributes) && graphic.attributes.OBJECTID === foundItem[0]) { selectedItem = graphic; switch (graphic.geometry.type) { case "point": graphic.setSymbol(pictureMarkerSymbol); break; case "polyline": graphic.setSymbol(selectedLineSymbol); break; case "polygon": graphic.setSymbol(selectedPolySymbol); break; } } }); var selectedItemExtent = selectedItem._extent.expand(0.2); map.setExtent(selectedItemExtent); ///map.centerAndZoom(selectedItemExtent, 0.5); map.centerAt(selectedItemExtent);
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.