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

Function to exclude columns from print

$
0
0

The client wants printed output that only includes the currently visible columns, which I can do with ':visible'. However they also want to exclude certain columns, irrespective of their visibility. So I need a way to exclude the columns they don't want, whilst selecting visible columns that aren't in the exclude list.

I think the only way I can do this is with a function as a column-selector. However I can't get it to work, just testing with the following:

                    {
                        extend: "print",
                        text: "Print - Results",
                        exportOptions: {
                            function(idx, data, node) {
                                return false;
                            }
                        }
                    }

As far as I can tell, the function doesn't execute when I click the print button, and all columns appear in the output.

I've tried to do a test case of this but I get a script error when I include the buttons plugin:

http://live.datatables.net/lekoduwu/1/edit?html,js,console,output

Can you either tell me what I'm doing wrong in the demo, or let me know if what I'm trying to do with the Print button is possible?

Cheers.


Viewing all articles
Browse latest Browse all 81728

Trending Articles



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