简体   繁体   中英

Are there callbacks on the Jquery Datatables Export buttons?

So I just implemented jquery datatables and added the export buttons. I was wondering if there are any callbacks on export. Let say I have a list of items in the database that i am showing in the datatable and I want to remove them from the database after i have exported them.

Please any help is appreciated.

No not as far as I know. But you can create your own custom Button and define an action for it. Inside that action you can call the export function and afterwards do whatever you are up to.

new $.fn.dataTable.Buttons( table, {
    buttons: [
        {
            text: 'Create CSV',
            action: function ( e, dt, node, config ) {     
                // Call the default csvHtml5 action method to create the CSV file
                $.fn.dataTable.ext.buttons.csvHtml5.action.call(this, e, dt, node, config);                 

                // Do custom processing
                alert('Other stuff');
            }
        }
    ]
} );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM