Original User: MurselinhoHello Everyone... I have a map and i want query on that is on.when i click checkbox ican get releated query for example-SOKAK_KODU=2126 and i can show result only one or i retry again another checkbox it doesnt work...Why??when i click checkbox calling ShowOnMap function
function ShowOnMap(id,tip)
{
var lyrx = "";
var mapQuery = "";
if (tip == "MAHALLE") {
mapQuery = "MAHALLE_KO =" + id ;
lyrx = "/2";
}
else if (tip == "ILCE") {
mapQuery = "ILCE_KODU =" + id ;
lyrx = "/3";
}
else {
mapQuery = "SOKAK_KODU =" + id ;
lyrx = "/1";
}
// I could get my query string and ı have ready for call LoadMap function
LoadMap(mapQuery, lyrx);
}
thats working first caling or load page but i cant show my query result when i calling after first callingfunction LoadMap(QueryText,lyr) {
require([
"esri/map",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/tasks/QueryTask",
"esri/tasks/query",
"esri/symbols/SimpleMarkerSymbol",
"esri/InfoTemplate",
"dojo/_base/Color",
"dojo/domReady!"], function (Map, ArcGISDynamicMapServiceLayer, QueryTask, Query, SimpleMarkerSymbol, InfoTemplate, Color) {
//create map and add layer
map = new Map("map", {
zoom: 9,
minZoom: 0
});
var layer = new ArcGISDynamicMapServiceLayer(url[0]);// url[0] is my service
map.addLayer(layer);
var queryTask = new QueryTask(url[0] +lyr);// lyr is my query layer
var query = new Query();
query.returnGeometry = true;
query.where = QueryText;
query.outFields = ["*"];
queryTask.execute(query, function (featureSet) {
map.graphics.clear();
var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new dojo.Color([100, 100, 100]), 2), new dojo.Color([0, 0, 255, 0.20]));
for (var i = 0, il = featureSet.features.length; i < il; i++) {
//Get the current feature from the featureSet.
//Feature is a graphic
var graphic = featureSet.features;
var infoTemplate = new esri.InfoTemplate();
infoTemplate.title = "${FID}";
infoTemplate.content = "<b>NUMBER_KEY: </b>${FID}";
graphic.setInfoTemplate(infoTemplate);
graphic.setSymbol(symbol);
//Add graphic to the map graphics layer.
map.graphics.add(graphic);
map.setExtent(graphic.geometry.getExtent().expand(2));
ClearNewHamuleModal();
}
});
});