Hi, I'm adding a button to the screen and calling ...
# suitescript
i
Hi, I'm adding a button to the screen and calling a restlet. 2 UI questions: • Is it possible to add a loading icon while waiting • Is it possible to disable the button after the click
b
nothing native will get you your loading bar
you can probably do it yourself using css and a little javascript
or you can using a loading bar/spinner javascript library
i
Ah ok, so nothing on the official docs. Just good old JS/CSS. Thanks!
b
while sweetalert2 is more of an alert, its pretty and simple enough to work
i
Nice, thanks! As the button was added in a userevent it was trivial to disable it:
Copy code
document.getElementById("custpage_btn_NAMEOFBUTTON").disabled = true;
I also needed a refresh link in the button, just added a N/ui/message for it:
Copy code
var mymsg = message.create({
      title: "My title",
      message: dataFromRest.body + "<p><b><a href='#' onclick='window.location.reload(true);'>Please refresh!</a></b></p>",
      type: message.Type.INFORMATION
    });
I'll try the spinner later on! Thanks