我有一个数据表,我想删除默认排序顺序。我尝试这样做:
"order": [[-1, "asc"]]
或 "order": false
它可以工作,但它也删除了分页和搜索框,我不想要这样。
我该怎么做?
<table id="dtBasicExample" class="table table-striped table-bordered table-sm" cellspacing="0" width="100%">
<thead>
<tr>
<th>Estatus</th>
<th>Tipo Documento<i class="fa fa-sort"></i></th>
<th>Nº Electrónico<i class="fa fa-sort"></i></th>
<th>Fecha<i class="fa fa-sort"></i></th>
<th>Acciones</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
</tfoot>
</table>
<script>
$(document).ready(function(){
$('#dtBasicExample').DataTable({
"order": [[-1, "asc"]]
});
$('.dataTables_length').addClass('bs-select');
});
</script>
最佳答案
你试过吗
<script>
$(document).ready(function(){
$('#dtBasicExample').DataTable({
"ordering": false,
"paging": true,
"search": true,
"info": true
});
$('.dataTables_length').addClass('bs-select');
});
</script>
关于javascript - 删除 DataTable 的默认排序 "order",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56829173/