美文网首页Web前端之路
table2excel 不能导出 input 输入框

table2excel 不能导出 input 输入框

作者: oNexiaoyao | 来源:发表于2020-06-28 14:27 被阅读0次
  • 使用方式

    <script src="./js/common/jquery.table2excel.js"></script>
    
  • 具体导出代码

    $('#tableShow').table2excel({
        exclude: ".noExl",
        name: "Excel Document Name",
        filename: "name-" + moment($('#dateTime').data('DateTimePicker').date()).format('YYYY-MM-DD'),
        fileext: ".xls",
        exclude_img: true,
        exclude_links: true,
        exclude_inputs: true
    })
    
  • input 输入框不能导出

    表格中的 input 框中的值不能导出(需要给 value 赋值)

    // input 动态赋值
    $(".table tr td").each(function (index, el) {
        if ($(this).find('input').length) {
            // 存在 input
            $(this).find('input').attr('value', $(this).find('input').val());
        }
    })
    
  • selectpicker 下拉项被导出

    // 暂时清除下拉列表
    $('.single-cell ul').empty();
    
    // 导完表格后 refresh
    $('.selectpicker').selectpicker('refresh');
    

相关文章

网友评论

    本文标题:table2excel 不能导出 input 输入框

    本文链接:https://www.haomeiwen.com/subject/jgfwfktx.html