Is it possible to use an event to show a modal when a file download is occurring?
In my case I have a SC API file that is triggered as a routed href on a button and the destination is a file download but the query takes a couple of seconds to complete before the download happens.
I’d like a modal to show while this takes place. Using normal SC elements on the page you can use the state value for dynamic events, is there a way with a linked file download?
Thanks Ken,
This is a link to an SC with file download so not a page SC component, therefore I don’t have the SC to monitor the state. If I put an SC on the page and call it with a dynamic event on a button, it just returns the CSV data in the call (XHR) but doesn’t initiate the download.
You can’t track the progress using this method.
If you want to show a loader or something else while the csv is being generated, then you can use a regular server action call and client-side download.
So click a button, run the generate csv server action - show the loader while executing. On done show/enable the download button which users can click and get the generated file.