Tabletools 初始化选项不适用

Tabletools initialization options not applying

我正在尝试向我的 datatables/tabletools init 添加一些设置,但出于某种原因,无论我为 tabletools 更改什么设置,默认选项仍然显示(即复制应该 > "Copy to Clipboard" 和它仍然是 "Copy")。当我单击按钮时,它们会起作用,所以我知道它正在寻找我的 SWF。我正在使用最新版本的 tabletools 和 datatables。

我已经尝试了两种旧的匈牙利表示法:

"oTableTools": { "aButtons": [ {"sExtends": "copy", "sButtonText": "Copy to Clipboard", "mColumns": [1,2,3,4,5]}, {"sExtends": "print"}, {"sExtends": "csv", "columns": [1,2,3,4,5]}, {"sExtends": "pdf", "columns": [1,2,3,4,5]}, {"sExtends": "xls", "columns": [1,2,3,4,5]} ] }

以及

"tableTools": { "buttons": [ {"extends": "copy", "buttonText": "Copy to Clipboard", "columns": [1,2,3,4,5]}, {"extends": "print"}, {"extends": "csv", "columns": [1,2,3,4,5]}, {"extends": "pdf", "columns": [1,2,3,4,5]}, {"extends": "xls", "columns": [1,2,3,4,5]} ] }

我是不是做错了什么?

谢谢

正确的初始化如下所示。请参阅 TableTools example 进行演示。

$('#example').DataTable( {
    "dom": 'T<"clear">lfrtip',
    "tableTools": {
        "aButtons": [
            {
                "sExtends": "copy",
                "sButtonText": "Copy to Clipboard",
                "mColumns": [1,2,3,4,5]
            },
            {
                "sExtends": "print"
            },
            {
                "sExtends": "csv",
                "mColumns": [1,2,3,4,5]
            },
            {
                "sExtends": "pdf",
                "mColumns": [1,2,3,4,5]
            },
            {
                "sExtends": "xls",
                "mColumns": [1,2,3,4,5]
            }
        ]
    }
} );