Datatables 如何显示';处理';在jquery数据表中?
我使用jquerydatatables(angulardatatables)进行服务器端处理,消息“processing”在表的上方。我可以通过sDOM(lfrtip)更改位置,但是否可以将其放在数据表中(将p放入t)?是的……有几种方法可以做到这一点。我喜欢使用“加载gif”。因此,您的HTML如下所示:Datatables 如何显示';处理';在jquery数据表中?,datatables,angular-datatables,Datatables,Angular Datatables,我使用jquerydatatables(angulardatatables)进行服务器端处理,消息“processing”在表的上方。我可以通过sDOM(lfrtip)更改位置,但是否可以将其放在数据表中(将p放入t)?是的……有几种方法可以做到这一点。我喜欢使用“加载gif”。因此,您的HTML如下所示: <table id="main_index"> <img id="loading_gif" src="images/ajax-loader.gif"> <!-
<table id="main_index">
<img id="loading_gif" src="images/ajax-loader.gif"> <!--this is your loading image or div-->
</table>
编辑
根据你的评论,我认为这就是你想要的
如果要在加载时在表的区域内显示消息,请使用以下结构:
<table id="main_index">
<div id="table_processing">Whatever text you want</div>
</table>
你想要什么文本都行
然后,您可以使用我的原始答案中的代码来隐藏它,以便在加载表时隐藏这个div
处理
选项需要设置为true
及sDom
选项中,需要字母r
var options = {
"sDom": 'prtp',
"processing": true,
"serverSide": true,
"ajax": "/path/to/my/ajax.php"
}
var oTable = $('.datatables').dataTable(options);
谢谢你的回答@jonmrich,我对解决方案不是很清楚。我不想插入其他元素。我已将“正在处理”消息替换为加载gif,只希望它显示在正确的位置。对于我的datatable,我希望将它放在table元素中我编辑的答案将完全满足您的需要。它将文本放入表中,直到加载表时将其删除
var options = {
"sDom": 'prtp',
"processing": true,
"serverSide": true,
"ajax": "/path/to/my/ajax.php"
}
var oTable = $('.datatables').dataTable(options);