AnsweredAssumed Answered

Call a function within queryTask showResults

Question asked by wgsl on May 20, 2016
Latest reply on May 20, 2016 by wgsl

Hi, I am very new to the WAB and dojo stuff. I really had a hard time with my first custom widget project. Please see below for a snippet of the codes. When I test the widget, an error appeared "TypeError: this.somethingElse() is not a function" within the _showResults. So how to make a call within _showResults and pass parameters to it? Thanks for your help!

 

_query: function(){

   var query = new Query();

   query.where = "Id > 0";

   query.outFields = ["ID", "Name"];

   query.returnGeometry = true;

 

   var queryTask = new QueryTask('http://.....');

   queryTask.on("complete", this._queryTaskExecuteCompleteHandler);

   queryTask.on("error", this._queryTaskErrorHandler);

   queryTask.execute(query, this._showResults);

},

 

_showResults: function(featureSet){

//do something here...

   this._somethingElse(featureSet.features);

},

 

_somethingElse: function(features){

     console.log(features.length);

     //and do something else here

}

Outcomes