Copy/export selected rows checkbox

Copy/export selected rows checkbox

pipedreamer007pipedreamer007 Posts: 2Questions: 1Answers: 0

Hi everyone -

I'd like to allow my users to copy/export selected rows only if they check an "Export ONLY selected rows" checkbox otherwise the table should copy/export ALL the rows in the table. However, I've been unable to find a way to do this.

I believe the buttons.buttons.action() function may be what I'm looking for...but I don't know how to correctly use the function. I attempted to pass a new config object to the default csvHtml5 action method to create the CSV file. It returns the correct number of rows but the data is just garbage.

Here is the link to my clean test case (without errors) to give you an idea of what I'm attempting:
http://live.datatables.net/suyanuyo/1/edit

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,177Questions: 1Answers: 2,590
    Answer ✓

    You would use exportOptions.rows for that, see buttons.exportData() - here it's just creating the XLS file if the first name starts with 'A', you would do something similar with your checkboxes,

    Colin

  • pipedreamer007pipedreamer007 Posts: 2Questions: 1Answers: 0

    Thanks for pointing me in the right direction, Colin! Greatly appreciate your time & help!

    I was able to get the result I needed and I've modified the code in the test case to assist anyone else looking for something similar to what I needed here:
    http://live.datatables.net/suyanuyo/3/edit

Sign In or Register to comment.