Is it possible to destroy a QueryTask while it's executing?

Discussion created by stevel on Aug 2, 2011
Latest reply on Aug 15, 2011 by stevel
I've built a slider bar control which runs a QueryTask automatically on update - as soon as you release the slider's handle, the query executes.

This works fine if the user waits for the QueryTask to finish before moving the slider again, but if they move the slider again quickly, there may be concurrent QueryTasks in operation.

How can I destroy the first QueryTask when the second QueryTask starts?

The QueryTask is called using an onChange event handler on the slider bar, which runs the line:

searchQueryTask.execute(searchQuery, showSearchResults, errResults);

(I've experimented with disabling the slider bar while the query is running, but this isn't ideal from a usability perspective)