Is it possible to cancel a PrintTask. I don't see any cancelJob() method in the API documentaion. I see a cancelJob() in the Geoprocessor methods. I was wondering if there is something like that for the PrintTask. Would be helpful. Users sometimes submit large maps on accident and have to wait a few minuets for the task to end.
Does anyone have any ideas ?
Thanks,
Check out the 'requestOptions' (RequestOptions) parameter of the execute(...) method; maybe the 'signal' (AbortSignal) property is something to try out. This might allow you to build the UI so you can allow the user to continue using the UI without having to wait for a response.
...and here's a quick codepen showing this concept: https://codepen.io/john-grayson/pen/LYRmGxY
Wow I appreciate the codepen! I see what you're doing.
Nice, It works on Synchronous but I have this on Asynchronous. I tried to switch it to Synchronous but it times out after 60 seconds. Even though I change the time limit from 60seconds to 120 seconds. Weird.
Is there a way I can do this with Asynchronous. It's weird. It does work on Asynchronous but it still goes through and keeps fetching until the last one and then it cancels it.
Do you have a codepen/jsbin showing the issue? Maybe make a copy of mine and modify it so we can experience the issue described? The concept for the shared code is to provide a UX that allows the user to cancel and continue using the app regardless of if/when the print calls themselves get canceled, but this might not be what you're after.
I will try to whip something up.
It's just that you have to change the setting to Asynchronous on the server side. In the manager setting for the service. So I will have to try and figure that out. Thanks for all the help so far!