AnsweredAssumed Answered

Query result extent not centering in map

Question asked by gschwitz on Dec 11, 2013
Latest reply on Dec 11, 2013 by geonetadmin
I have various query tasks that will zoom to the result in the map in my application.  The extent that is zoomed to is offset towards the bottom if a single result is returned and if there are multiple results, all of them are not shown on the map.  When I resize the footer, for some reason everything then works as it is supposed to.  My script that zooms to the points is:
                function showResults(featureSet) {                     var filterArray = [];                     map.graphics.clear();//clear graphics from map                     map.infoWindow.hide();//hide infowindow                                    var resultFeatures = featureSet.features;//Performance enhancer - assign featureSet array to a single variable.                     for (var i = 0, il = resultFeatures.length; i < il; i++) {//loop through all features                         if (resultFeatures.length == 1) {                             var graphic = resultFeatures[i];                             graphic.setSymbol(symbol);                             nameGraphic = map.graphics.add(graphic);                             var thePoint = resultFeatures[0].geometry;//get single point                             map.centerAndZoom(thePoint, 4);//can add zoom level too                         }                         else if (resultFeatures.length > 1) {                             graphic = resultFeatures                             //var extent = resultFeatures[0].geometry.getExtent().expand(1.5);                             var extent = esri.graphicsExtent(graphic);//get graphics extent of more than 1 feature                             map.setExtent(extent, true); //use to get whole extent//map.setExtent(extent.expand(3));                          }                         else {                             var myFeatureExtent = esri.graphicsExtent(resultFeatures);                             map.setExtent(myFeatureExtent);                         }                             if (resultFeatures.length == 1) {                                 msg = resultFeatures.length + " Feature Selected"                                 document.getElementById('selectedPane').innerHTML = msg;                             }                             else {                                 msg = resultFeatures.length + " Features Selected"                                 document.getElementById('selectedPane').innerHTML = msg;                             }                     }                    }


I'm not sure if this is a map resize or CSS issue.  Has anyone encountered something similar?  Here are a couple screenshots as examples:

Before resize:[ATTACH=CONFIG]29768[/ATTACH]

After resize: [ATTACH=CONFIG]29769[/ATTACH]

Thanks,
Geoff

Outcomes