Queries being completed out of order sometimes

1577
2
01-27-2012 04:20 AM
RexBradford
New Contributor II
In my app it is possible to issue queries on the same layer in rapid enough succession that the issue of out-of-order execution of the response is an issue.  Is there any way of tagging the queries so they can be identified in the callback?  I saw on the IOS thread that an NSOperation associated with each query can be used for this purpose.  Is there any mechanism in the Javascript toolkit for identifying what query invoked the callback?

The only thing I can think to do is to associated each query with a different (identical except that the function itself serves as an id) callback function, but that seems pretty lame.

Thanks,

Rex Bradford
Direct Relief International
0 Kudos
2 Replies
JeffPace
MVP Alum
In my app it is possible to issue queries on the same layer in rapid enough succession that the issue of out-of-order execution of the response is an issue.  Is there any way of tagging the queries so they can be identified in the callback?  I saw on the IOS thread that an NSOperation associated with each query can be used for this purpose.  Is there any mechanism in the Javascript toolkit for identifying what query invoked the callback?

The only thing I can think to do is to associated each query with a different (identical except that the function itself serves as an id) callback function, but that seems pretty lame.

Thanks,

Rex Bradford
Direct Relief International


Instead of different callbacks, why not just pass an additional identifying variable to the callback along with the resultset

we do:
task.execute(q, dojo.hitch(this, "searchCallback", layerData.name, layerdesc, layerData.titleField));

which allows us to use just one callback but have layer dependent functionality.

our searchCallback then looks like

searchCallback: function(layerId, layerdesc, titleField, featureSet) {
0 Kudos
RexBradford
New Contributor II
Instead of different callbacks, why not just pass an additional identifying variable to the callback along with the resultset

we do:
task.execute(q, dojo.hitch(this, "searchCallback", layerData.name, layerdesc, layerData.titleField));

which allows us to use just one callback but have layer dependent functionality.

our searchCallback then looks like

searchCallback: function(layerId, layerdesc, titleField, featureSet) {


Ah, thanks.  I am not much of a dojo expert - the dojo.hitch is something I haven't used.  Will try it.

Rex Bradford
Direct Relief International
0 Kudos