Habitat
Habitat

Reputation: 709

Tabletools initialization options not applying

I'm trying to add some settings to my datatables/tabletools init but for some reason no matter what settings I change for tabletools the default options still show (I.e. Copy should be > "Copy to Clipboard" and it remains as "Copy"). When I click the buttons they function so I know it's finding my SWF. I am using the latest version of tabletools and datatables.

I've tried both the old hungarian notation:

"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]} ] }

as well as

"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]} ] }

Am I doing something wrong?

Thanks

Upvotes: 1

Views: 301

Answers (1)

Gyrocode.com
Gyrocode.com

Reputation: 58930

Proper initialization is shown below. See TableTools example for demonstration.

$('#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]
            }
        ]
    }
} );

Upvotes: 1

Related Questions