Hi there, I trying to find out what i have miss in the code. Here the code :
function searchPrecinct(prct){
presint = "";
map.graphics.clear();
dojo.byId("result").innerHTML = "";
strwhere = "PRECINT_ID='"+ prct +"'";
query.where = strwhere;
qTaskPrecinct.execute(query);
alert(strwhere);
dojo.connect(qTaskPrecinct,'onComplete',function(fSetPrct){
var resultFeatures = fSetPrct.features;
if (resultFeatures.length==0){
dojo.byId("result").innerHTML = "No record.";
return;
}
ixmin = 0; iymin = 0; ixmax = 0; iymax = 0;
for (var j=0; j<resultFeatures.length; j++){ //get xy min max
var graphic = resultFeatures ;
presint = graphic.attributes.PRECINT_ID;
if (j==0){
ixmin = graphic.geometry.getExtent().xmin;
iymin = graphic.geometry.getExtent().ymin;
ixmax = graphic.geometry.getExtent().xmax;
iymax = graphic.geometry.getExtent().ymax;
}
else{
if (graphic.geometry.getExtent().xmin < ixmin) ixmin = graphic.geometry.getExtent().xmin;
if (graphic.geometry.getExtent().ymin < iymin) iymin = graphic.geometry.getExtent().ymin;
if (graphic.geometry.getExtent().xmax > ixmax) ixmax = graphic.geometry.getExtent().xmax;
if (graphic.geometry.getExtent().ymax > iymax) iymax = graphic.geometry.getExtent().ymax;
}
}
var newExtent = new esri.geometry.Extent();
newExtent.xmin = ixmin - 6;
newExtent.ymin = iymin - 6;
newExtent.xmax = ixmax + 7;
newExtent.ymax = iymax + 7;
map.setExtent(newExtent, true);
setTimeout( function() {
newExtent.xmin += 1;
newExtent.xmax += 1;
map.setExtent(newExtent, true);
}, 1000);
});
I failed to zoom into the result... Anybody can help me?
... View more