identifyTask.execute(identifyParams, buildTable); } function buildTable(queryResults){ ...do work }
findTask.execute(findParams, buildTable);
identifyTask.execute(identifyParams, buildTable(queryResults,"identify")); } function buildTable(queryResults, method){ ...do work and make my table from queryResults }
findTask.execute(findParams, buildTable(queryResults,"find"));
Solved! Go to Solution.
var _funcMaker = function(type) { return function(queryResults) { // do something with results based on type // that was passed to it }; }; findTask.execute(findParams, _funcMaker("find"));
var task = new esri.tasks.QueryTask(url); task.execute(q, dojo.hitch(this, "searchCallback", linklayer, layerdesc, titleField, outfields, zoomScale, linkField));
searchCallback: function(layerId, layerdesc, titleField, fields, zoomScale, linkField, featureSet ) {
var _funcMaker = function(type) { return function(queryResults) { // do something with results based on type // that was passed to it }; }; findTask.execute(findParams, _funcMaker("find"));
If I understand correctly, you can also pass it what I believe is referred to as a function maker.var _funcMaker = function(type) { return function(queryResults) { // do something with results based on type // that was passed to it }; }; findTask.execute(findParams, _funcMaker("find"));
The _funcMaker function will take any 'extra' params you want to use and return the function that processes the queryResults.