Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82036

How to add an action to the API?

$
0
0

I'm looking to add this hack to my code
This can be a temporary fix for colvis, responsive export when using visible selector.
I'm referring to this post https://github.com/DataTables/Responsive/issues/90

buttons: [
    {
        name: 'print',
        extend: 'print',
        exportOptions: {
           columns: [':visible:not(.not-export-col):not(.hidden)'],
        },
        action: function(e, dt, button, config) {
            responsiveToggle(dt);
            $.fn.DataTable.ext.buttons.print.action(e, dt, button, config);
            responsiveToggle(dt);
        }
    },
]

I just don't know where to put the toggle action toggle code
I believe that need to be on datatables,js but not sure where and what is the syntax I should use.

responsiveToggle(dt) {
    $(dt.table().header()).find('th').toggleClass('all');
    dt.responsive.rebuild();
    dt.responsive.recalc();
}


Viewing all articles
Browse latest Browse all 82036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>