[fastadmin]第二十二篇 fastadmin table 排序技巧
首先排序是按照对应的js中,orderName来的
代码如下:
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
这里sortName就是排序字段。
#其次,想要指定字段排序。可以给列增加一个属性。
如下:
{field: 'id', title: __('Id'),sortable: true},
则后台列表显示为:
![[fastadmin]第二十二篇 fastadmin table 排序技巧](https://cdn.learnku.com/uploads/images/202401/23/46135/gHxFirNIuY.png!large)
![[fastadmin]第二十二篇 fastadmin table 排序技巧](https://cdn.learnku.com/uploads/images/202401/23/46135/IxCEY4MMas.png!large)
本作品采用《CC 协议》,转载必须注明作者和本文链接
关于 LearnKu
推荐文章: