AnsweredAssumed Answered

Trying to zoom to vehicles from two separate dgrids

Question asked by mrogers83 on Apr 30, 2014
Latest reply on May 8, 2014 by mrogers83
I am trying to zoom to a point with two separate dgrids.  The two codes for the zoom to are following:
      
function selectUnit(e) {            
 // select the feature
 var flzoom = map.getLayer("units");
 var query = new Query();            
 query.objectIds = [e.id];            
 flzoom.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(result) {              
  if ( result.length ) {
   point = result
   // re-center the map to the selected feature                
   window.map.centerAndZoom(result[0].geometry, 100);
   } else {                
   console.log("Feature Layer query returned no features... ", result);              
  }
  flzoom.clearSelection();
 });
}
      
function selectPolice(e) {            
 // select the feature
 var pflzoom = map.getLayer("police");
 var query = new Query();            
 query.objectIds = [e.id];            
 pflzoom.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(result) {              
  if ( result.length ) {
   point = result
   // re-center the map to the selected feature                
   window.map.centerAndZoom(result[0].geometry, 100);
   } else {                
   console.log("Feature Layer query returned no features... ", result);              
  }
  pflzoom.clearSelection();
 });
}


This is the code that calls the separate functions:
function actionRenderCell(object, value, cell, options) {
 var image = new Image();
 image.src = "images/zoom.png";
 image.onclick = function () {selectUnit(object);};
 return image;
}
      
function idRenderCell(object, value, cell, options){
 var image = new Image();
 image.src = "images/zoom.png";
 image.onclick = function () {selectPolice(object);};
 return image;
}


This is the error I get for the selectPolice function:
dojo.io.script errorError: Invalid or missing input parameters.

I'm sure it has something to do with how I'm coding to zoom from the objectid, but I'm not sure how to fix it.  Any help is appreciated, thanks.

Outcomes