AnsweredAssumed Answered

add a button click event in _showResult()

Question asked by wgsl on May 23, 2016
Latest reply on May 24, 2016 by wgsl

HI, very confused about this dojo API and widget stuff. I want to add a button click event in the QueryTask _showResults() function so zooming to a feature is triggered ONLY when a button gets clicked. The following codes automatically trigger the button click event after the query finishes which is not what i want. Please help!

 

_query: function(){

   var query = new Query();

   query.where = "1=1";

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

   query.returnGeometry = true;

 

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

   queryTask.execute(query, lang.hitch(this, this._showResults));

},

_showResults: function(featureSet){

        this.own(on(this.btnZoomTo, "click", lang.hitch(this, this.map.centerAndZoom(featureSet.features[0].geometry, 10))));

},

Outcomes