AnsweredAssumed Answered

timing issue -- anyone who is good with deferreds?

Question asked by kait_davis on Nov 12, 2013
Latest reply on Dec 17, 2013 by ionarawilson
I'm building an editing application, and I use a custom drop-down menu for one of the fields in my attribute inspector. The drop down is populated by a query, so it's very important that the query function completes before the function that builds the attribute inspector. My problem is timing the query. My map listener map.on("layers-add-result", initEditor); fires initEditor well before my query has had the chance to complete and as a result my map features become disabled. I can fix the problem by pausing the execution of initEditor with an alert box, but obviously this can't be a permanent solution.

I believe a deffered would help ensure that my query task has returned before populating my attribute inspector, but I am weak on the concept. Is there a programmatic way to say map.on("layers-add-result", initEditor) after query returns results?

Outcomes