2
我正在使用jQuery Datatables,並且我有一個HTML頁面,用於顯示錶中的數據庫記錄。最初,表格中加載了50條記錄,然後每次滾動到底部時追加50條記錄。搜索不適用於動態創建的行
現在,jQuery DataTables搜索函數對前50條記錄工作正常,但無法識別在無限滾動期間動態創建的其他記錄。
HTML和數據表初始化:
$(document).ready(function() {
$('body #new_table').dataTable({
'scrollX': true,
'scrollY': 600,
'paging': false,
"ordering": false,
'info' : false,
'aaSorting': []
});
});
<table id="new_table">
<thead>
<tr>
<th>ChemicalID</th>
<th>Product</th>
<th>Manufacturer</th>
<th>Registered Name</th>
</tr>
</thead>
<tbody id="items" class="display table table-bordered">
@foreach($data as $chemical)
<tr class="item">
<td>{{$chemical->ChemicalID}}</td>
<td>{{$chemical->Product}}</td>
<td>{{$chemical->Manufacturer}}</td>
<td>{{$chemical->RegisteredName}}</td>
</tr>
@endforeach
</tbody>
</table>
非常感謝.......它適用於我。 –
@ user3783146,然後請將答案標記爲已接受,未來的訪問者可以看到這是一個可靠的解決方案。 – davidkonrad