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