在 jQuery DataTables 中显示处理消息

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11311505/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 10:28:04  来源:igfitidea点击:

Display processing message in jQuery DataTables

jquerydatatables

提问by xyz

EDIT :
I want to use the default processing message feature provided by datatables but looks like it works only with server side processing. I am not using server side processing.

编辑:
我想使用数据表提供的默认处理消息功能,但看起来它只适用于服务器端处理。我没有使用服务器端处理。



Original Question :
I want to display processing message in DataTableswhenever I am adding / deleting records from DataTables. I am not using server side processing, depending on few events I delete / add records to DataTables.

原始问题:每当我
DataTables 中添加/删除记录时,我都想在DataTables 中显示处理消息。我没有使用服务器端处理,这取决于我删除/添加记录到 DataTables 的几个事件。

I tried using bProcessingas trueand sProcessingto give custom progress message but looks like it works only with server side processing. How can I achieve same with without server side processing? How can I explicitly call a function which displays processing message?

我尝试使用bProcessingastruesProcessing来提供自定义进度消息,但看起来它只适用于服务器端处理。如何在没有服务器端处理的情况下实现相同的目标?如何显式调用显示处理消息的函数?

Here is a similar examplebut it uses server side processing.

这是一个类似的示例,但它使用服务器端处理。

Thanks.

谢谢。



Solution :
DEMOThanks @Robodude.

解决方案:
演示谢谢@Robodude。

回答by RoboKozo

So I firebugged the example and there is a hidden div on the page that contains the "Processing..." text and the way I imagine display of it is controlled is right before the ajax for the server processing is sent, it shows it and when it's completed, it hides it. I would check to see if you have a default hidden div on your table when enabling bProcessing and control its visibility when the conditions for it appearing are met.

所以我对这个例子进行了调试,页面上有一个隐藏的 div 包含“正在处理...”文本,我想象它的显示控制方式就在发送服务器处理的 ajax 之前,它显示它和当它完成时,它会隐藏它。我会在启用 bProcessing 时检查您的表上是否有默认的隐藏 div,并在满足它出现的条件时控制其可见性。

The id of the hidden div should be the ID.OF.YOUR.TABLE_processing

隐藏 div 的 id 应该是 ID.OF.YOUR.TABLE_processing

So now I'd create handlers for the different conditions that you need to account for much like the examples seen here:

所以现在我将为您需要考虑的不同条件创建处理程序,就像这里看到的示例一样:

http://datatables.net/release-datatables/examples/advanced_init/events_live.html

http://datatables.net/release-datatables/examples/advanced_init/events_live.html