schlot

Zoom To in InfoWindow - which types of infoWindows add it automatically?

Discussion created by schlot on Dec 20, 2012
I have an IdentifyTask which was likely to return multiple points because the features are colocated.  Through some examples, I saw that I needed to build an array to set the features for map.infowindow.setFeatures.
 function executeIdentifyTask(evt) {    
     identifyParams.mapExtent = map.extent; 
     identifyParams.geometry = evt; //input from address, evt is already a map point
     var inputPt = evt;
     identifyParams.geometry = evt.mapPoint;     
     inputPt = evt.mapPoint;  

      var deferred = identifyTask.execute(identifyParams);
        deferred.addCallback(function(response) {      
          // response is an array of identify result objects     
          // Let's return an array of features. 
          return dojo.map(response, function(result) { 
            var feature = result.feature; 
            feature.attributes.layerName = result.layerName; 
            feature.setInfoTemplate(infoTemplate);
              return feature;             
          }); 
        }); 
 
        // InfoWindow expects an array of features from each deferred object that you pass. If the response from the task execution  
        // above is not an array of features, then you need to add a callback like the one above to post-process the response and return an 
        // array of features. 
        map.infoWindow.setFeatures([ deferred ]); 
        map.infoWindow.show(inputPt); //point type is the same coming from either method
     //   map.infoWindow.show(evt.mapPoint); 

    
      } 


I have the definitions set for Popup (a popup variable defined as well as including that in my map definition).

var popup = new esri.dijit.Popup({ 
            fillSymbol: new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_NULL, 
          new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,255,0]), 3), new dojo.Color([255,255,0,0.35])) 
        }, dojo.create("div"));
  
         var spatialReference = new esri.SpatialReference({wkid: 102100 });
        startExtent = new esri.geometry.Extent(-10723197,4186914,-9829190,4992866, spatialReference);
        map = new esri.Map("map",{extent:startExtent, infoWindow:popup} );            


With this definition, when I do an Identify, no only do I get the left/right arrows to step through any multiple records that are identified, but I also get the "zoom to" at the bottom of the infoWindow. 

Within this same code, I have a datagrid with a list of features.  I have added the zoom button based on the example DataGrid with zoom button.  I'm not sure I really want to zoom, instead I really wanted to have this also trigger the infoWindow.  Not all my attributes are in my datagrid, only an ID number and a status.  The infoWindow would show all the attributes.

function zoomRow(id){ 
      //  alertLayer.clearSelection(); 
        var query = new esri.tasks.Query(); 
      // query.text = id;
        query.where = "Server_ServerName = '" + id + "'";
        query.outFields = ['*'];
      query.returnGeometry = true;
     var zoomQueryTask = new esri.tasks.QueryTask("https://ogi.oa.mo.gov/arcgis/rest/services/ITSD/serverLocation/MapServer/0");
    zoomQueryTask.execute(query,showAlertResults);
    }
    function showAlertResults(results) {
    var feature = results.features[0];
    feature.setInfoTemplate(infoTemplate);
    var content = esri.substitute(feature.attributes,infoTemplateContent);
    map.infoWindow.setContent(content);
    map.infoWindow.setTitle(feature.attributes.FlagStatusReason);
      //  map.infoWindow.setContent(content);
        map.infoWindow.show(feature.geometry);
    }


Even though I'm still calling map.infoWindow.show, these infoWindows don't have the zoom to in them.  Am I going to have to go through the same steps for the queryTask that the Identify has (setting a callback on deferred etc etc) in order to get the 'zoom to' to be in my InfoWindow?  I don't really understand exactly what was triggering this in the first place.

Outcomes