How to get row selection export working?

How to get row selection export working?

stustu Posts: 1Questions: 1Answers: 0

I'm trying to export selected rows for a csv but the select example on the website doesn't work.

https://datatables.net/extensions/buttons/examples/print/select.html

If you select a couple rows and press the 'Print selected' button you get an empty table rather than the rows you have selected.

I am trying to generate a csv rather than print the selected but I get the same result; an empty csv.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,141Questions: 26Answers: 4,918
    edited December 2016

    It appears to be an issue with dataTables.buttons.js 1.2.3. I can export the selected rows to a CSV using 1.2.2 but not with 1.2.3. 1.2.3 results in no data just the headings.

    Not sure if the selected option is supposed to work when providing export options, for example:

                    extend: 'collection',
                    text: 'Export Selected',
                    exportOptions: {
                        modifier: {
                            selected: true
                        }
                    },
                    buttons: [
                        'copy',
                        'excel',
                        'csv',
                        'pdf',
                        'print'
                    ]
                },
    

    With this config all of the data is returned.

    Kevin

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin
    Answer ✓

    It is indeed a bug in 1.2.3 I'm afraid. The nightly version of Buttons has the required fix in it and I'll do a release with that fix soon.

    Allan

This discussion has been closed.