duanmu1736 2019-01-14 09:12
浏览 181

在Datatable PDF和Excel中导出图像视图

I'm working with a Laravel Blade file. I want to export the table to PDF, and it seems to work correctly. However, there is a problem while displaying the image. It only shows the image path, not the image after exporting.

exportOptions: {
    stripHtml: false,

Added but not working

$(document).ready(function() {
  var buttonCommon = {
     extend : 'pdfHtml5',
    exportOptions: {
              stripHtml: false,
              columns: 'th:not(:last-child)',

     exportOptions: {
              stripHtml: false,
              //columns: 'th:not(:nth-child(2))',
        format: {
            body: function ( data, row, column, node ) {
                // Strip $ from salary column to make it numeric
                return column === 4 ?
                    data.replace( /[$,]/g, '' ) :
                    data;
            }
        }
     }
    }
};
  //$.noConflict();
   $('.datatable').DataTable({
       processing: true,
       serverSide: true,
       //"oSearch": { "bSmart": false, "bRegex": true },
       ajax: '{{ route('customers.getdata') }}',
       columns: [
           {data: 'id', name: 'id'},
           {data: 'profilepic', name: 'profilepic',render: function( data, type, full, meta ) {
                   if(data==0) { return "<img src=\"/customers/default.png"  + "\" height=\"50\"/>"; } else { return "<img src=\"/customers/" + data + "\" height=\"50\"/>"; }
                }},
           {data: 'name', name: 'name'},
           {data: 'email', name: 'email'},
           {data: 'phone', name: 'phone'},
           {data: 'address', name: 'address'},
           {data: 'created_by', name: 'created_by'},
           {data: 'status', name: 'status',render: function( data, type, full, meta ) {
                    if(data==1) { return "Active"; } else { return "Inactive"; }
                }},
        {data: 'action', name: 'action', orderable: false, searchable: false}
       ],
       dom: 'Bfrtip',
       buttons: [
        $.extend( true, {}, buttonCommon, {
            extend: 'copyHtml5',

        } ),
        $.extend( true, {}, buttonCommon, {
            extend: 'excelHtml5',

        } ),
        $.extend( true, {}, buttonCommon, {
            extend: 'pdfHtml5',

        } )
    ]

   });
});

I need an image view rather than an image path.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 各位请问平行检验趋势图这样要怎么调整?说标准差差异太大了
    • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
    • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
    • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
    • ¥15 运动想象脑电信号数据集.vhdr
    • ¥15 三因素重复测量数据R语句编写,不存在交互作用
    • ¥15 微信会员卡等级和折扣规则
    • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
    • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
    • ¥15 gdf格式的脑电数据如何处理matlab