AnsweredAssumed Answered

Passing additional parameters to a function within identifyResults

Question asked by abrown31 on Oct 17, 2012
Latest reply on Oct 18, 2012 by abrown31
First, I admit that I only have limited "hands on" experience programming with Javascript. So, I apologize for any ignorance.

I have a function that dynamically creates a DOJO table with the results of an identifyTask and a findTask. If the user performs a findTask, I want to send in a parameter to my "buildTable" function so that the map extent is changed to the extent of the findTask results. If "buildTable" is called using identifyTask, I don't want the map's extent to change to the results. This is part of my working code below:

identifyTask.execute(identifyParams, buildTable);                      }          function buildTable(queryResults){         ...do work }


findTask.execute(findParams, buildTable);


Currently, "buildTable" has no idea what function called it, whether the identifyTask or the findTask, so I'm trying to implement an additional parameter for "buildTable", a type string, identifying what method is calling it. Unfortunately, due to my limited experience using Javascript, I cannot get my following code to work. What I don't understand is: currently, "buildTable" is called without passing it a parameter (no parenthesis), so how does my parameter queryResults receive data?

identifyTask.execute(identifyParams, buildTable(queryResults,"identify"));                      }          function buildTable(queryResults, method){         ...do work and make my table from queryResults }


findTask.execute(findParams, buildTable(queryResults,"find"));


The code above obviously doesn't work, as I receive "queryResults is not defined", so how exactly can I get something like my above example to work? Or, does somebody have a better method to use so "buildTable" knows what task was used so it can do appropriate work?

Thanks,
Andrew

Outcomes