map.setExtent(buildingExtent); executeIdentify(feature.extent?? or something like this)
console.log (buildingExtent);
//add the building Directory files buildingLayer = new esri.layers.FeatureLayer("http://webgis.uwm.edu/ArcGISUWM/rest/services/CampusJava/MapServer/0",{ mode:esri.layers.FeatureLayer.MODE_SELECTION, maxAllowableOffset:maxOffset(map,1), outFields:["NAME","Abbreviati","OBJECTID"] }); //define a selection symbol // var highlightSymbol = new esri.symbol.SimpleFillSymbol().setColor( new dojo.Color([50,205,50,.25])); //buildingLayer.setSelectionSymbol(highlightSymbol); dojo.connect(buildingLayer,'onLoad',function(layer){ var query = new esri.tasks.Query(); query.where = "1=1"; layer.queryFeatures(query,function(featureSet){ var items = dojo.map(featureSet.features,function(feature){ return feature.attributes; }); var data = { identifier:"NAME", items:items}; store = new dojo.data.ItemFileReadStore({data:data}); grid.setStore(store); grid.setSortIndex(1,"true"); //sort on the state name }); }); //modify the grid so only the Building_NAME field is sortable grid.canSort = function(col){ if(Math.abs(col) == 2) { return true; } else { return false; } }; } function makeZoomButton(id){ var zBtn = "<div dojoType='dijit.form.Button'><img src='images/zoom2.png'"; zBtn = zBtn + " width='20' height='20'"; zBtn = zBtn + " onClick=\"zoomRow('"+id+"')\"></div>"; return zBtn; } function zoomRow(id){ buildingLayer.clearSelection(); var query = new esri.tasks.Query(); query.objectIds = [id]; buildingLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW,function(features){ //zoom to the selected feature var buildingExtent = features[0].geometry.getExtent().expand(5.0); map.setExtent(buildingExtent); }); <div dojotype="dijit.layout.ContentPane" title="Building<br />Directory" selected="false"> <table dojotype="dojox.grid.DataGrid" jsid="grid" id="grid" selectionMode="none"> <thead> <tr> <th field="OBJECTID" formatter="makeZoomButton" width="25px"> <img alt="+" src="images/zoom2.png"/> </th> <th field="NAME" width="135px">Building</th> <th field="Abbreviati" width="53px">Abb.</th> </tr> </thead> </table> </div>
Thanks for the input. Chris, the first link you posted is the application that I referenced to add the Google basemap. I didn't mention it in the first post is that if I'm using a esri basemap the zoom function works fine and I used the wkid = 102100. I referenced this app for the zoom functionality. http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htmIf there is something that I missed let me know.Thanks againChris
var mp = new esri.geometry.webMercatorToGeographic(evt.mapPoint);
console.log(extent????or something like this);
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.