Datatable TableTools in Editor not showing up.

Datatable TableTools in Editor not showing up.

mRendermRender Posts: 151Questions: 26Answers: 13
edited June 2014 in Editor

I want to add the Regular datatable tools to the editor, but I'm not sure how. I've added the "tableTools" sswfpath but that doesn't seem to make them show up.

var editor; // use a global for the submit and return data rendering in the examples

editor = new $.fn.dataTable.Editor( {
ajax: "DataTables-1.10.0/extensions/Editor-1.3.1/examples/php/staff.php",
"tableTools": {
"sSwfPath": "DataTables-1.10.0/extensions/TableTools/swf/copy_csv_xls_pdf.swf"
},

$('#example').DataTable( {
    dom: "Tfrtip",
    ajax: "DataTables-1.10.0/extensions/Editor-1.3.1/examples/php/staff.php",
    columns: [
        { data: null, render: function ( data, type, row ) {
            // Combine the first and last names into a single table field
            return data.first_name+' '+data.last_name;
        } },
        { data: "position" },
        { data: "office" },
        { data: "extn" },
        { data: "start_date" },
        { data: "salary", render: $.fn.dataTable.render.number( '\'', '.', 0, '$' ) }
    ],
    tableTools: {
        sRowSelect: "os",
        aButtons: [
            { sExtends: "editor_create", editor: editor },
            { sExtends: "editor_edit",   editor: editor },
            { sExtends: "editor_remove", editor: editor },
        ]
    }
} );

} );
</script>

website demo: http://108.160.144.86/testingeditor.php

This question has an accepted answers - jump to answer

Answers

  • mRendermRender Posts: 151Questions: 26Answers: 13
    edited June 2014

    alright, I got them to show up, but they aren't working except for print. Here's my updated code that I used...

    tableTools: {

            sRowSelect: "os",
    
            aButtons: [
    
                { sExtends: "editor_create", editor: editor },
    
                { sExtends: "editor_edit",   editor: editor },
    
                { sExtends: "editor_remove", editor: editor },
    
                "print",
    
                {
    
                    "sExtends":    "collection",
    
                    "sButtonText": "Save",
    
                    "aButtons":    [ "csv", "xls", "pdf" ]}
    
            ]
    
  • allanallan Posts: 61,722Questions: 1Answers: 10,108 Site admin
    Answer ✓

    Yup - that's how to add the buttons!

    To get them working, you might need to enable Flash in your browser, or specify the sSwfPath option of TableTools to point at the SWF file. Your server error logs will show if there are any 404 errors.

    Allan

This discussion has been closed.