I am using the ArcGIS API for JavaScript.
Right now, I am trying to change the extent of a view dynamically.
<script>
var view;
var new_ext;
require([
"esri/views/MapView",
"esri/WebMap",
"esri/geometry/Extent",
"dojo/on",
"dojo/domReady!"
], function (MapView, WebMap, Extent) {
var webmap = new WebMap({ portalItem: { id: "fedda3...." } });
view = new MapView({
map: webmap,
container: "mapdiv",
center: [-102.45, 47.75],
zoom: 10
});
// Set the extent on the view
view.extent = {
xmin: 17.265,
ymin: 21.99,
xmax: 17.314,
ymax: 21.964,
spatialReference: { wkid: 4326 }
};
new_ext = new Extent();
});
function react_to_event() {
// will be loaded by ajax later on
new_ext = {
xmin: 17.065,
ymin: 21.79,
xmax: 17.114,
ymax: 21.764,
spatialReference: { wkid: 4326 }
};
view.goTo(new_ext);
}
</script>
function react_to_event() is just returning an "undefinied". What would be the right approach to animate the view to an other extent?