构建ranks的容器
<table class="layui-hide" id="ranks"></table>
layui調用表格组件
/*layui調用*/ layui.use(['table', 'carousel', 'layer'], function () { var table = layui.table, carousel = layui.carousel; table.render({ elem: '#ranks' , url: 'api/api.php?act=getRank&token=3cab7ce4142608c0f40c785b5ab5ca24' , id: 'searchTable' , loading: false , cols: [[ {type: 'numbers'} , {field: 'store_area', title: '地區'} , {field: 'trans_store', title: '門店'} , {field: 'trans_deal', title: '訂單量', sort: true} , {field: 'trans_quantity', title: '銷售量', sort: true} , {field: 'trans_total', title: '總金額', sort: true} ]] }); var $ = layui.$, active = { reload: function () { var tableData = $('#tableData'); table.reload('searchTable', {}); } }; $('#layTable').on('click', function () { var type = $(this).data('type'); active[type] ? active[type].call(this) : ''; }); });
定时模拟单击按钮
function getLayuiTable() { $("#layTable").click(); }
lockdatav done!