【发布时间】:2020-10-19 11:32:22
【问题描述】:
在我的一些数据表上没有显示排序和搜索。红框是我想要显示的,但我无法让它们在我的某些桌子上显示你。数据表完全相同,我复制了代码但没有任何改变。所以我问是否有人对我有解决方案?
下面你会看到我的一些 javascript 和 html 代码:
--- javascript ---
$("#dataTablesFull, #dataTablesFull2, #dataTablesFull3, #dataTablesFull4").dataTable( {
"pageLength": <?php echo getConfigValue("table_records"); ?>,
"dom": '<"top"f>rt<"bottom"><"row dt-margin"<"col-md-6"i><"col-md-6"p><"col-md-12"B>><"clear">',
"buttons": [ 'copy', 'csv', 'excel', 'pdf', 'print' ],
"stateSave": true,
"fixedHeader": false,
"oLanguage": {
"sSearch": "",
"sEmptyTable": "<?php _e('Oops! Er is niets om weer te geven.'); ?>",
"sZeroRecords": "<?php _e('Niets gevonden'); ?>",
"sInfo": "<?php _e('Weergeven van: '); ?> _START_ <?php _e('tot'); ?> _END_ <?php _e('van'); ?> _TOTAL_ <?php _e('records.'); ?>",
"sInfoEmpty": "",
"oPaginate": {
"sNext": "<?php _e('Volgende'); ?>",
"sPrevious": "<?php _e('Vorige'); ?>",
"sFirst": "<?php _e('Eerste pagina'); ?>",
"sLast": "<?php _e('Laatste pagina'); ?>"
}
},
"columnDefs": [ { "orderable": false, "targets": -1 } ] }
);
--- html ---
<div class="table-responsive">
<table id="dataTablesFull" class="table table-striped">
<thead>
<tr>
<th>Naam</th>
<th>E-mail</th>
<th>Antwoord</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($contacts as $contact) { ?>
<tr>
<td>
<?php echo $name; ?>
</td>
<td>
<?php echo $email; ?>
</td>
<td>
<?php
if(empty($answer)) {
echo " -";
}
if(!empty($answer)) {
echo $answer;
}
?>
</td>
<td>
<?php
if($contact['status'] == 0) {
echo "Verzonden";
}
if($contact['status'] == 1) {
echo "Beantwoord";
}
?>
</td>
<td>
<div class='pull-right btn-group'>
<a href="#" onClick='#' class='btn btn-info btn-flat btn-sm'><i class='fa fa-eye'></i></a>
<a href="#" onClick='#' class='btn btn-danger btn-flat btn-sm'><i class='fa fa-trash-o'></i></a>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
【问题讨论】:
标签: javascript html jquery datatables