todo

html table排序,搜索,datatables

up:2024-04-30 13:41:06 edit:2024-04-30 17:04:13 view:351

https://datatables.net/


示例:



<link rel="stylesheet" href="//cdn.datatables.net/2.0.5/css/dataTables.dataTables.min.css" />
<script type="text/javascript" src="//cdn.datatables.net/2.0.5/js/dataTables.min.js">script>
<script src="//cdn.datatables.net/plug-ins/2.0.5/sorting/file-size.js">script>
<script src="//cdn.datatables.net/plug-ins/2.0.5/sorting/formatted-numbers.js">script>





let table = new DataTable('#detail',{
paging: false,//不启用分页
order:[]//保持原顺序
,columnDefs:[

{ type: 'file-size', targets: sizeI } //按文件大小排序 https://datatables.net/plug-ins/sorting/file-size

,{ type: 'formatted-num', targets: shardI}//尽量按数字排(忽略非数字后缀)
, destroy: true// enable reinit

]

//orderFixed: [$('#detail tr:first th:contains(total size)').index(), 'desc']
});





not in sinaapp