我想隐藏数据表thead如果表没有任何数据.
oTable_topics =$('#showTopics').dataTable({
"bLengthChange": false,
"bStateSave": true,
"iDisplayLength": 12,
"bScrollCollapse": true,
"bJQueryUI": true,
"bAutoWidth": false,
"sAjaxSource": "server_processing.php",
"sPaginationType": "full_numbers",
"bProcessing": true
});
function clickRowHandler_topics() {
$('#showTopics tbody tr').bind('click', function () {
var aData = oTable_topics.fnGetData( this );
iId_topics = aData[1];
});
}
Run Code Online (Sandbox Code Playgroud)
我认为如果表没有任何数据隐藏thead有利于为用户显示任何消息,如何隐藏?
小智 13
试试这个:
"fnDrawCallback": function ( oSettings ) {
$(oSettings.nTHead).hide();
}
Run Code Online (Sandbox Code Playgroud)
每个'draw'事件都会调用"fnDrawCallback"函数,并允许您动态修改所需的有关创建的DOM的任何方面.
I know this is an old question but answering for others as this was the top result while I was looking into how to do this.
"drawCallback": function() {
$(this.api().table().header()).hide();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13886 次 |
| 最近记录: |