在 NetSuite 中处理\动画

Processing \Animation in NetSuite

我有这个客户端脚本,它复制在 Copy line# 中输入的行号,并根据在 Copy #Times 中输入的行数创建新行。 当您增加需要复制的行数时,这会花费一些时间。那么我们可以提供任何处理动画直到所有行都设置好让用户不必担心吗?

我试过给 dialog.create 但没用。我希望动画一直保持到脚本执行,然后停止。

var options = {
                    title: 'Alert',
                    message: 'Processing. Please wait.',
                     buttons: [{
                     label: 'OKK...',
                     value: 1
                     },
                     ]
                    };
                    dialog.create(options).then(success)
                    return (true);

success 是我调用的函数。

N/ui/dialog 模块用于显示可关闭的消息,并且不会真正用于进度条,因为您无法隐藏按钮,也无法通过代码将其关闭。我建议查看第三方库。一个非常受欢迎的是 SweetAlert2, and there is some sample code 在 NetSuite Professionals 站点上用于将它与 NetSuite 一起使用。

如果您只想快速破解,可以 只使用 NetSuite 默认包含在所有页面上的 Ext.js library。但是,我强烈建议不要对任何生产代码这样做,因为 NetSuite 可能会在未来的升级中随时更新或删除它。

var messageBox = Ext.MessageBox.show({
  title: 'Lines are being copied...',
  msg: 'This may take a couple minutes',
  wait: true,
  width: 250
});

// your work here

messageBox.hide()