Select to view content in your preferred language

queryTask is undefined

2580
4
05-21-2010 01:22 PM
JuneAcosta
Frequent Contributor
I have code that I have put together from different samples that have been posted. I'm trying to get the map to zoom to a point that is selected from the combo box. The code fails at this line..... queryTask.execute(neighQuery, zoomNeighborhoodResults);

I have tried to use the firefox/firebug... I put a breakpoint at the line before it one step through it nothing happens, but this could be a a user issue too. Here's the code- I appreciate any help.
0 Kudos
4 Replies
DerekSwingley
Regular Contributor
Make queryTask a global variable (like your map, trailsCached and resizeTimer variables). Currently, you define queryTask in init() and then try to reference it in neighQuery(). This doesn't work because queryTask is not defined in neighQuery's scope.
0 Kudos
by Anonymous User
Not applicable
the reason you got is you haven't define the querytask in your current function("zoomNeighborhood").
make it as a globle varient...
0 Kudos
JuneAcosta
Frequent Contributor
Thank you- that resolved the issue. Now I am having an issue with zooming to the selected marker in the drop down. The map zooms out to the full extent of all the features, but not to the selected. I got this code from a previous post so maybe I copied it wrong. Could you please provide some help on the zoomNeighborhood function?
0 Kudos
JuneAcosta
Frequent Contributor
I figured out the issue with the zoom function. I had to change the service for the querytask to point to my cached service instead of my dynamic service.
0 Kudos