2017-08-11 111 views

回答

0

您可以在emptyTable配置中指定html

默認值將是

價值:在表

沒有可用的數據,但可以呈現任何HTML而不是默認的字符串

"emptyTable": "<h1>Empty table custom html</h1><div><span>any span</span></div>" 

var columnDefs = [{ 
 
    title: "Column 1" 
 
}, { 
 
    title: "Column 2" 
 
}]; 
 

 
$(document).ready(function() { 
 
    $('#table').DataTable({ 
 
    "language": { 
 
     "emptyTable": "<h1>Empty table custom html</h1><div><span>any span</span></div>" 
 
    }, 
 
    columns: columnDefs, 
 
    }); 
 
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> 
 
<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script> 
 
<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css" /> 
 

 
<table id="table"></table>

相關問題