jQuery数据表隐藏主题 [英] jQuery datatables hide thead

查看:88
本文介绍了jQuery数据表隐藏主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果表没有任何数据,我想隐藏datatable thead.

i want to hide datatable thead if table dont have any data.

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];
        });
    }

我认为如果表格没有任何隐藏数据的数据,那么该代码很适合向用户显示任何消息,该如何隐藏呢?

i think if table dont have any data hiding thead is good for display any message for users, how to hide that?

推荐答案

尝试一下:

"fnDrawCallback": function ( oSettings ) {
    $(oSettings.nTHead).hide();
}

"fnDrawCallback"函数在每个绘制"事件上调用,并允许您动态修改想要创建的DOM的任何方面.

这篇关于jQuery数据表隐藏主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆