数据表打印按钮没有出现

时间:2017-07-19 13:11:13

标签: javascript jquery css datatables

a.extend])throw"无法扩展未知按钮类型:" + a.ex

不能为我的生活,弄清楚如何显示打印按钮。

我已经包含了这些js库;

    <link href="https://cdn.datatables.net/buttons/1.3.1/css/buttons.dataTables.min.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/javascript" src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
<script language="JavaScript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.print.min.js"></script>
<script language="JavaScript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.3.1/js/dataTables.buttons.min.js"></script>

和js来调用它;

oTableHoliday = $("#holidayPayrollTable").dataTable({

    dom: "Bfrtip",
    buttons : [{
        extend: 'print',
        text: 'Print current page',
        exportOptions: {
            modifier: {
                page: 'current'
            }
        }
    }],
    "bServerSide": true,
    "sAjaxSource": "/AdminPayrollHolidayTable",
    "bProcessing": true,
    "sPaginationType": "full_numbers",
    "bJQueryUI": true,
    "bLengthChange": false,
    "bFilter": false,
    "bInfo": true,
    "bStateSave": true,
    "bAutoWidth": false,
    "iDisplayLength": 25,
    "sScrollY": "350px",
    "aoColumns": [
        {"bSortable": false, "sWidth": "14%"},
        {"bSortable": false, "sWidth": "14%"},
        {"bSortable": false, "sWidth": "14%"},
        {"bSortable": false, "sWidth": "14%"},
        {"bSortable": false, "sWidth": "14%"},
        {"bSortable": false, "sWidth": "14%"},
        {"bSortable": false, "sWidth": "14%"}
    ],
    "columnDefs": [{className: "center", "targets": [ 0,1,2,3,4,5,6 ]}],
    "fnServerData": function(sSource, aoData, fnCallback)
    {
        aoData.push({"name": "date", "value": comDate});

        $.getJSON(sSource, aoData, function(json)
        {
            fnCallback(json);
        });
    }
}),

它看起来应该有效吗?我无法了解如何找到印刷品。

0 个答案:

没有答案