脚本执行时的模态加载消息

发布于 2024-10-14 13:50:40 字数 355 浏览 1 评论 0原文

我尝试了多种方法来解决这个问题,但一直无法解决。

基本上,我有一个大型数据表,由 Java 提供给 DOM,当页面加载数据表时,它会被加载,但随后由外部脚本 (DataTables @ datatables.net) 进行解析,该脚本对网格进行样式设置并添加功能。问题是,表格显示在页面上时没有样式,并且没有数据表脚本的功能,然后在脚本执行完成后消失并重新加载。

我想要做的是通过 jQuery 在页面加载时隐藏页面上的所有内容,然后在脚本执行后显示它,然后关闭模式加载对话框。

我的问题是:有没有办法通过模式运行加载消息,直到所有脚本都执行完毕。表中的数据相当大(2000 条记录),需要一些时间来编译......

感谢您的帮助!

I have tried several methods to solve this but have been unable to get a work around.

basically I have a large data table that is being given to the DOM by Java, as the page loads the data table loads but then is parsed by an external script (DataTables @ datatables.net) that styles and adds functionality to the grid. The problem is that the table shows up on the page un-styled and without the functions of the data tables script then disappears and reloads once the script is done executing.

What I want to do is hide the all the content on the page via jQuery on the page load then show it once the script executes and then close a modal loading dialog.

My question is: Is there a way to run a loading message via a modal until all scripts have executed. The data in the table is pretty large (2000 records) and takes some time to compile....

Thanks for any help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

瑾兮 2024-10-21 13:50:40

我能想到的唯一方法是通过 ajax 加载数据和所有内容。这样,您可以加载一个非常快速的页面,其中没有太多内容,并显示加载模式对话框,开始您的表的ajax,一旦完成,您可以使用它来关闭对话框

The only way I could think of doing this would be to load the data and everything for it via ajax. That way, you can load a very quick page with not much on it and show the loading modal dialogue, the begin your ajax for the table which would send a response once finished that you could use to close the dialogue

生生漫 2024-10-21 13:50:40

我想做的是将数据表加载到隐藏元素中,例如

<div style="display:none">
     Put datatable here.
</div>

显示加载模式(不是使用javascript,它应该已经是DOM的一部分并且可见),并在回调中处理JS正在执行的工作我会做这样的事情:

function myCallBack()
{
     $('#loadingModal').hide();
     $('#dataTableDiv').show();
}

What I would try to do is load the datatable into a hidden element like a

<div style="display:none">
     Put datatable here.
</div>

Show the modal that says loading(not with javascript, it should already be part of the DOM and visible), and in the callback for whatever JS is doing the work I would do something like this:

function myCallBack()
{
     $('#loadingModal').hide();
     $('#dataTableDiv').show();
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文