table2excel 不能导出 input 输入框

  • 使用方式

    <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');
    
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。