my codes:
in chorom:
Now I confused, my god ,what happend??
they are the same in local/web api !
Solved! Go to Solution.
Zhongren,
Is there a reason that you are not using a local variable for query and queryTask in your initData function? Why would you want it to be scoped to the whole widget source by using 'this.' ? Your overall issue is a scope problem. Inside the execute block the scope of 'this' is not the same as it was before.
initData: function () {
var query = new Query();
query.outFields = [this.config.queryFields];
query.outSpatialReference = this.map.spatialReference;
query.where = this.config.queryWhere;
var queryTask = new QueryTask(this.config.queryTaskUrl);
queryTask.execute(query,
lang.hitch(this, function (featureSet) {
console.log(featureSet);
}),
lang.hitch(this, function (error) {
console.log(error);
})
);
.....
},
Robert Scheitlin, GISPDan Patterson
thank you very much!!
Hi, not sure what's going on there but can it be because of a typo where you are creating the new QueryTask?
`this.config.qeuryTaskUrl` vs. `this.config.queryTaskUrl`, swap the 'eu'?
Not this reason, i check every words , but thank you very much !![]()
Zhongren,
Is there a reason that you are not using a local variable for query and queryTask in your initData function? Why would you want it to be scoped to the whole widget source by using 'this.' ? Your overall issue is a scope problem. Inside the execute block the scope of 'this' is not the same as it was before.
initData: function () {
var query = new Query();
query.outFields = [this.config.queryFields];
query.outSpatialReference = this.map.spatialReference;
query.where = this.config.queryWhere;
var queryTask = new QueryTask(this.config.queryTaskUrl);
queryTask.execute(query,
lang.hitch(this, function (featureSet) {
console.log(featureSet);
}),
lang.hitch(this, function (error) {
console.log(error);
})
);
.....
},
Thank you very much!
good night!