如何将flash按钮转换为datatables stackoverflow中的html按钮

时间:2016-07-06 09:51:31

标签: datatables

$('#example').DataTable( {
        dom: 'T<"clear">lfrtip',
        "bPaginate": false,
        "bSort" : false,
        "bFilter": false, 
        tableTools: {
            "aButtons": [

                {
                    "sExtends": "xls",
                    "sButtonText": "Download Excel",
                     "sTitle": '<?php echo $name['first_name'].'-'.$name['last_name'].'-'.$name['id'];?>',
                    "oSelectorOpts": {
                        page: 'current'
                    }
                },
                {
                    "sExtends": "pdf",
                    "sButtonText": "Download PDF",
                     "sTitle": '<?php echo $name['first_name'].'-'.$name['last_name'].'-'.$name['id'];?>',
                    "sPdfOrientation": "landscape",
                    "sPdfMessage": "<?php echo $name['first_name'].' '.$name['last_name'].' PreApp 1003 Application Details'; ?>"
                },
                 {
                    "sExtends": "mae",
                    "sButtonText": "Download in Fannie-Mae",
                    "sTitle": '<?php echo $name['first_name'].'-'.$name['last_name'].'-'.$name['id'];?>',
                    "sPdfOrientation": "landscape",

                }
            ]
        }
    } );

1 个答案:

答案 0 :(得分:0)

TableTools扩展程序不支持该功能https://datatables.net/extensions/tabletools/HTML5版本。由于它现在已经退役,所以不要指望这个功能可用。

但是,TableTools已转换为另一个Buttons https://datatables.net/extensions/buttons/扩展程序,该扩展程序同时支持HTML5SWF版本。

$(document).ready(function() {
    $('#table').DataTable( {
        dom: 'Bfrtip',
        buttons: [
            'copyHtml5',
            'excelHtml5',
            'pdfHtml5'
        ]
    } );
} );

在此处查看更多示例https://datatables.net/extensions/buttons/examples/html5/index.html