I have a widget that needs to get information from a geoprocessing service on creation in order to populate a table. Even though I've setup the geoprocessing service to be synchronous, it seems like the code is behaving as if it were asynchronous (at least the postCreate/startup/onOpen functions).
What I'm doing: (not sure how to make it look like formatted code, but here I go.)
postCreate: function (){
this.inherited(arguments);
myGPfunction();
followupFunction();
},
startup: function(){
this.inherited(arguments);
},
onOpen: function(){
//do something
},
I can get the followupFunction() to wait for myGPfunction() (I've figured out how to incorporate the .then).
My problem is when I click to launch to widget in my map, postCreate,startup,onOpen all fire off. I see in the console that PanelManager & WidgetManager say my widget have been created, then I see my results from the myGPfunction after that.
How do I get things to wait until I receive my data before continuing with creation?
Solved! Go to Solution.
Jayson,
You do not have control of the widget life cycle events and delaying their execution. You need to re-examine your work flow and adjust.
Jayson,
You do not have control of the widget life cycle events and delaying their execution. You need to re-examine your work flow and adjust.
I was afraid of that. I assume the startup and onOpen functions operate in the same manner?
Correct