简体   繁体   English

Jquery Datatables Export按钮上是否有回调?

[英]Are there callbacks on the Jquery Datatables Export buttons?

So I just implemented jquery datatables and added the export buttons. 因此,我只实现了jquery数据表并添加了导出按钮。 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');
            }
        }
    ]
} );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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