找到對應的js
public/assets/js/backend/user/user.js
table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'weigh',//默認排序字段 sortOrder:'asc',//默認排序方式 escape: true, search: true, pagination: true, pageList: [10, 20, 50, 'All'], commonSearch: true, columns: [ [ { checkbox: true }, { field: 'id', title: __('Id'), sortable:true}, //字段使用排序
利用sortName可以進行默認排序,如果設定了這個那么sortOrder則不生效
另外再羅列一些其他功能,字段加添加 sortable:true 就可以動態搜索並排序了
原文地址:http://www.aumoc.com/index.php/2020/02/25/fastadmin-table-bootstraptable-sort-order/