How to return the query ids from a featuretable to the function or code that requested it?

1721
0
09-03-2015 05:41 AM
PaulHaakma
Regular Contributor

Hi all.

I'd be interested to know how others would approach this:

Say I want to query a feature table. The following code takes a query and fires a request to the featuretable which results in a list of queryIds.

myFeatureTable.queryIds(query)

In the featuretable I then put some code within the onQueryIdsStatusChanged handler which does something with the list of Ids. All good.

But, what I really want is the following:

var listOfIds = myFeatureTable.queryIds(query);

The reason could be that maybe I want to fire off two different queries at the same time to the featuretable and work with both sets of results. Or perhaps I have a dozen places in my app that fire off requests and do different things with the results - how do I then return the list back to the function/code that called it in order to work with that list?

E.g. this is what I would ideally want:

var listOfIds1 = myFeatureTable.queryIds(query1);

var listOfIds2 = myFeatureTable.queryIds(query2);

// do some stuff with the two lists....

So the question is: how to return the result back to the function that actually requested it?

0 Kudos
0 Replies