Getting Export Button added In Editor

Getting Export Button added In Editor

davidjmorindavidjmorin Posts: 101Questions: 31Answers: 0
edited June 2020 in Free community support

How would I get the export button for CSV to the below code?

    new $.fn.dataTable.Buttons( table, [
        { extend: "create", editor: editor },
        { extend: "edit",   editor: editor },
        { extend: "remove", editor: editor }
    ] );

My whole Script:

(function($){

$(document).ready(function() {
    var editor = new $.fn.dataTable.Editor( {
        ajax: 'php/table.rma_submissions.php',
        table: '#rma_submissions',
        fields: [
            {
                "label": "rma_number:",
                "name": "rma_number"
            },
            {
                "label": "paid:",
                "name": "paid"
            },
            {
                "label": "paid_date:",
                "name": "paid_date"
            },
            {
                "label": "device_id:",
                "name": "device_id"
            },
            {
                "label": "Location:",
                "name": "location"
            }
        ]
    } );

    var table = $('#rma_submissions').DataTable( {
        ajax: 'php/table.rma_submissions.php',
        columns: [
            {
                "data": "rma_number"
            },
            {
                "data": "paid"
            },
            {
                "data": "paid_date"
            },
            {
                "data": "device_id"
            },
            {
                "data": "location"
            }
        ],
        select: true,
        lengthChange: false
    } );

    $('#example').on( 'click', 'tbody td:not(:first-child)', function (e) {
        editor.inline( this );
    } );

    new $.fn.dataTable.Buttons( table, [
        { extend: "create", editor: editor },
        { extend: "edit",   editor: editor },
        { extend: "remove", editor: editor }
    ] );


    table.buttons().container()
        .appendTo( $('.col-md-6:eq(0)', table.table().container() ) );
} );

}(jQuery));

Answers

  • davidjmorindavidjmorin Posts: 101Questions: 31Answers: 0

    Figured it out.

    { extend: "csv", text: "Export", filename:"RMA Submissions"}
    
This discussion has been closed.