layui导出表格全部数据

    <div style="display: none">
       <table id="table">

       </table>
    </div>
    <button class="layui-btn" id="export">
        <i class="iconfont icon-export"></i> 导出
    </button>
 $(".export").click(function(){        
        var ins1=table.render({
            elem: '#data_export',
            url: "url", //数据接口
            method: 'post',
            title: '表名',
            where: {
                mycode: "all"
            },
            limit: 10,
            cols: [[
                {field: 'id', title: 'ID'},
                {field: 'name', title: '名字'},
            ]],
            done: function (res, curr, count) {
                exportData=res.data;
                table.exportFile(ins1.config.id,exportData, 'xls');
            }
        });
    })


有问题请联系作者QQ:4505399(备注:vb盒子)
« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。