で動作しません書き込み検索ボックスに任意の値を設定します。検索ボックスは、私たちは、ソートが機能していますが、検索ボックスが</p> <p>我々が働いていないすべての列に検索ボックス用&二thead要素をソートするための</p> <p>まずthead要素を働いていない</p> <p>検索ボックスのために第二thead要素に検索ボックスを置くデータテーブル
私たちのHTMLコード
<thead>
<tr>
<td><b>Customer Name</b></td>
<td><b>Contact Number</b></td>
<td><b>Contact Person Name</b></td>
<td><b>Contact Person Contact Number</b></td>
<td><b>City</b></td>
<td><b>Country</b></td>
<?php if($_SESSION['user_type'] == 'admin' || $_SESSION['user_type'] == 'super_admin' || $_SESSION['user_type'] == 'Director') { ?><td><b>Sales user name</b></td><?php } ?>
<td><b>Schedule</b></td>
<?php if($_SESSION['user_type'] == 'admin' || $_SESSION['user_type'] == 'super_admin') { ?><td><b>Created User</b></td><?php } ?>
<td><b>Action</b></td>
<?php if($_SESSION['user_type'] != 'Director'){ ?>
<td><b>Add</b></td>
<?php } ?>
</tr>
</thead>
<thead>
<tr>
<th>Customer Name</th>
<th>Contact Number</th>
<th>Contact Person Name</th>
<th>Contact Person Contact Number</th>
<th>City</th>
<th>Country</th>
<?php if($_SESSION['user_type'] == 'admin' || $_SESSION['user_type'] == 'super_admin' || $_SESSION['user_type'] == 'Director') { ?><th>Sales user name</th><?php } ?>
<th>Schedule</th>
<?php if($_SESSION['user_type'] == 'admin' || $_SESSION['user_type'] == 'super_admin') { ?><th>Created User</th><?php } ?>
<th>Action</th>
<?php if($_SESSION['user_type'] != 'Director'){ ?>
<th>Add</th>
<?php } ?>
</tr>
</thead>
は、私たちのjqueryのコード例から
$('#example1 thead th').each(function() {
var title = $(this).text();
$(this).html('<input type="text" placeholder="Search '+title+'" />');
});
// DataTable
var table = $('#example1').DataTable();
// Apply the search
table.columns().every(function() {
var that = this;
//alert(1);
$('input', this.header()).on('keyup change', function() {
if (that.search() !== this.value) {
that
.search(this.value)
.draw();
}
});
});
表の構造は、** TABLEのようにする必要があります - > THEAD - > TBODY **あなたの現在の構造が有効ではありません。 –
すでにTBODYが追加されています。&2つのthead&1 tbody&1 tfootも入れます –
1つを削除してから、試してみてください。 –