layui-数据表格排序

代码示例

见initSort方法


    function useTable(table) {
        table.render({
            elem: '#test'
            // ,url:"{:url('admin/statistical/order_num')}"
            , cellMinWidth: 80 //全局定义常规单元格的最小宽度,layui 2.2.1 新增
            , cols: [[
                {field: 'statistical_date',  200, title: '时间'}
                , {field: 'turnover',  200, title: '销售额'}
                , {field: 'play_type_count',  200, title: '微信支付'}
                , {field: 'invalid_order_count',  200, title: '作废额度'}
                , {field: 'packing_amount',  200, title: '打包费'}
                , {field: 'shipping_fee',  200, title: '外送费'}
                , {field: 'coupon_amount',  200, title: '优惠卷金额'}
                , {field: 'reduce_amount',  300, title: '新客立减金额'}
            ]],
            data: information, page: true,
            initSort: {
                field: 'statistical_date', 需要排序的字段
                type: 'desc' 排序方式
            }
        });
    }
原文地址:https://www.cnblogs.com/yaoliuyang/p/15209784.html