我在我的网站上使用数据表,但我不想在搜索表中缩小数据。
就我的研究而言,我只能找到如何更改信息"找不到匹配的记录"在我的自定义消息。
如果没有匹配的结果,我想显示5个空行。
如果Datatables中没有匹配的搜索,如何显示空行?
表初始化
$(document).ready(function() {
generateListEmployee("table.display");
generateNoSort("table.display2");
});
function generateListEmployee(tableId) {
$(tableId).dataTable({
"iDisplayLength" : 5,
"sDom" : '<"dashboardTable"t><"#paggination"p><"#search-container"f>',
"pagingType" : "full_numbers",
"oLanguage": { "sSearch": "" },
});
$('.dataTables_filter input').attr("placeholder", "Search");
}
表格HTML
<div id="all-employees-table-wraper">
<table id="all-employees-table" class="table table-hover display">
<thead>
<tr>
<th>Name, Surname</th>
<th>Initiative(s)</th>
<th>Position</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tiger Nixon1</td>
<td>System Architect1</td>
<td>Edinburgh</td>
<td>
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-link">
<span class="dashboard_icons-01"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-02"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-03"></span>
</button>
</div>
</td>
</tr>
<tr>
<td>Tiger Nixon2</td>
<td>System Architect2</td>
<td>Edinburgh</td>
<td>
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-link">
<span class="dashboard_icons-01"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-02"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-03"></span>
</button>
</div>
</td>
</tr>
<tr>
<td>Tiger Nixon3</td>
<td>System Architect3</td>
<td>Edinburgh</td>
<td>
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-link">
<span class="dashboard_icons-01"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-02"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-03"></span>
</button>
</div>
</td>
</tr>
<tr>
<td>Tiger Nixon4</td>
<td>System Architect4</td>
<td>Edinburgh</td>
<td>
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-link">
<span class="dashboard_icons-01"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-02"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-03"></span>
</button>
</div>
</td>
</tr>
<tr>
<td>Tiger Nixon5</td>
<td>System Architect5</td>
<td>Edinburgh</td>
<td>
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-link">
<span class="dashboard_icons-01"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-02"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-03"></span>
</button>
</div>
</td>
</tr>
<tr>
<td>Tiger Nixon1</td>
<td>System Architect1</td>
<td>Edinburgh</td>
<td>
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-link">
<span class="dashboard_icons-01"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-02"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-03"></span>
</button>
</div>
</td>
</tr>
<tr>
<td>Tiger Nixon2</td>
<td>System Architect2</td>
<td>Edinburgh</td>
<td>
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-link">
<span class="dashboard_icons-01"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-02"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-03"></span>
</button>
</div>
</td>
</tr>
<tr>
<td>Tiger Nixon3</td>
<td>System Architect3</td>
<td>Edinburgh</td>
<td>
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-link">
<span class="dashboard_icons-01"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-02"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-03"></span>
</button>
</div>
</td>
</tr>
<tr>
<td>Tiger Nixon4</td>
<td>System Architect4</td>
<td>Edinburgh</td>
<td>
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-link">
<span class="dashboard_icons-01"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-02"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-03"></span>
</button>
</div>
</td>
</tr>
<tr>
<td>Tiger Nixon5</td>
<td>System Architect5</td>
<td>Edinburgh</td>
<td>
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-link">
<span class="dashboard_icons-01"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-02"></span>
</button>
<button type="button" class="btn btn-link">
<span class="dashboard_icons-03"></span>
</button>
</div>
</td>
</tr>
</tbody>
</table>
</div>