I have a script on a transaction that at times can...
# suitescript
p
I have a script on a transaction that at times can take 20 or so seconds to complete. Any ideas on how I can get a spinner (aka throbber) to show while the script is running? The script is looping through items and adding them based on search results. Depending on the results it can be anywhere from 10 - 30 items being added.
s
You saying a spinner on the whole page or just part of it? The general idea would be to grab part of the page (or whole body), hide it, and show the spinner instead. You can find a spinner code pretty easily online and just hide/show on save.
Copy code
function appendSpinner(pageTitle) {
        //hide page body
        jQuery('#div__body').css('display', 'none');
        //text at top
        jQuery('#body').append('<h1 style="style stuff">' + pageTitle + '</h1>');
        //spinner
        var spinner = jQuery('#custpage_spinner_html');
        jQuery('body').append(spinner[0].value);
    }
this is just an example of a page that has the spinner html already sitting on the page, and hides/shows it changing the whole page to a spinner
p
thanks for this. will use it to guide me in the process.