function runQuery() { var queryTask = new esri.tasks.QueryTask("http://gis.phila.gov/ArcGIS/rest/services/PhilaGov/Police_Incidents_Last30/MapServer/0"); var query = new esri.tasks.Query(); query.returnGeometry = true; query.where = '1=1'; query.outFields = ["DC_DIST", "POINT_X", "POINT_Y"]; map.on(queryTask, "onComplete", function(featureSet) { var cL = new clusterlayerNew({ displayOnPan: false, map: map, features: featureSet.features, infoWindow: { template: new esri.InfoTemplate("${SECTOR}"), width: 325, height: 100 }, flareLimit: 15, flareDistanceFromCenter: 20 }); map.addLayer(cL); }); };
queryTask.on("complete", function(event) {});since I am constructing a clusterlayer using the function features from my AMD class "clusterlayerNew." Is there a way to get the features from the function "features" while running after the queryTask is complete?
on(queryTask, 'complete', function(){});
queryTask.execute(query).then(someFunction);
function runQuery() { var queryTask = new esri.tasks.QueryTask("http://gis.phila.gov/ArcGIS/rest/services/PhilaGov/Police_Incidents_Last30/MapServer/0"); var query = new esri.tasks.Query(); query.returnGeometry = true; query.where = '1=1'; query.outFields = ["DC_DIST", "POINT_X", "POINT_Y"]; queryTask.on("complete", function(event) { var cL = new clusterlayerNew({ displayOnPan: false, map: map, features: event.featureSet.features, infoWindow: { template: new esri.InfoTemplate("${SECTOR}"), width: 325, height: 100 }, flareLimit: 15, flareDistanceFromCenter: 20 }); map.addLayer(cL); }); };
function runQuery() { var queryTask = new esri.tasks.QueryTask("http://gis.phila.gov/ArcGIS/rest/services/PhilaGov/Police_Incidents_Last30/MapServer/0"); var query = new esri.tasks.Query(); query.returnGeometry = true; query.where = '1=1'; query.outFields = ["DC_DIST", "POINT_X", "POINT_Y"]; queryTask.on("complete", function(event) { var cL = new clusterlayerNew({ displayOnPan: false, map: map, features: event.featureSet.features, infoWindow: { template: new esri.InfoTemplate("${SECTOR}"), width: 325, height: 100 }, flareLimit: 15, flareDistanceFromCenter: 20 }); map.addLayer(cL); }); };
on(queryTask, "onError", function(err) { alert(err.details); }); queryTask.execute(query);