Is there a way to do dialog.create() but not displ...
# suitescript
n
Is there a way to do dialog.create() but not display buttons? I am trying to use the dialog as sort of a visual key that the page is reloading and your process is working. Users are double clicking the button while the page is still refreshing.
n
n
I was trying to use dialog because it adds the mask to the page which also helps prevent clicking the button. I can't disable the button while the page is reloading so was thinking that would help
n
Gotcha. I did this little loading thing for a client that may work for you. Ill post the code below.
Copy code
jQuery("#_loading_dialog").attr("title", "Please Wait");
      jQuery("#_loading_dialog").html(
        `<div style="text-align: center; font-style: italic;">Updating Purchase Orders. Please wait.</div>
        <br><br>
        <div style="text-align: center; width:100%;">
        <i class="fas fa-cog fa-spin" data-fa-transform="grow-18"></i>
        </div>`
      );
      jQuery("#_loading_dialog").dialog({
        modal: true,
        width: 400,
        height: 160,
        resizable: false,
        closeOnEscape: false,
        position: { my: "top", at: "top+160", of: "#main_form" },
        open: function (evt, ui) {
          jQuery(".ui-dialog-titlebar-close").hide();
          setTimeout(function () {
            runAutomation(soId, entity);
          }, 100);
        },
      });
Theres a function it calls "runAutomation" that contains the code for what the script is doing.
tbf i don't mess with jQuery a lot. This is something i just found in a stack overflow thread. But it creates a little masked popup with a spinning wheel.
n
yeah, i have a way to get it to work with jQuery, but was hoping there was a way to hide that button without using that, more native netsuite
But nice solution
n
Oh here ya go. It still has the little X in the corner, but if you pass an empty array to the buttons param it won't load any buttons in. Ill leave you alone after this if its not what you want lol
Copy code
var options = {
    title: 'My Dialog',
    message: 'This is a message in my dialog.',
    buttons: []
  };

  dialog.create(options).show();
👍 2
c
You may want to use N/message not N/dialog. The dialog is a popup but message displays a banner at the top of the page which appears more appropriate for this use case
👍 1
f
You may use EXTjs library if you want a more "native" visual it should be easy and straightforward when implementing on a client script
m
Swal2 is a good library for this. I don't recommend using the version of ExtJS loaded by NetSuite because they can (and have) change versions or remove the library entirely
👍 3
f
yeah use ExtJS with caution, some pages like inbound shipments have already moved out of that library so thre's a risk that netsuite will do a ninja update removing ExtJS completely on other pages