如果没有可用数据,如何隐藏DataTable包装器?

时间:2016-06-23 12:09:35

标签: jquery

我正在使用jQuery数据表,如果没有数据,现在显示“表格中没有数据”,当数据存在时我试图隐藏#contractDataTable_wrapper,我试着跟随代码...

                                                                                                                                                                                                         NametypeLast ModifiedDate CreatedStatus                                                                                                               删除                                                                                                                                                       表中没有数据                     
$(document).ready(function(){
     if ($(".contractsTable .table-responsive").find(".dataTables_empty")) {
            $('.dataTables_empty').parents("#contractDataTable_wrapper").hide();
            $(".contractsEmptyData ").css("display", "block");
        }
})

1 个答案:

答案 0 :(得分:1)

只需查看 var empty = $(".yourTable tbody tr:eq(0) td").html(); if(empty == "No data available in table") { $("#contractDataTable_wrapper").hide(); } 文字

即可
db.collection.createIndex( { "email": 1 }, { "unique": true } )
db.collection.createIndex( { "second_email": 1 }, { "unique": true } )