1

Actually I want to sort out my copy data. The copy to clipboard is copying all the data from selected row. but I want the specific columns data. So, Please help me to copy data by skipping some columns.

This is the table and when the I select the row and click copy selected row then it's getting the total row data like below.

Here is the copied data pasted in excel. But I need some fields are skipped like below.

Like this specific result.

This is the table and when the I select the row and click copy selected row then it's getting the total row data like below. Here is the copied data pasted in excel. But I need some fields are skipped like below. Like this specific result. Here is my datatable's script, Please help me someone.

$(document).ready( function () {
    $('#myTable').DataTable({
        "scrollX": true,
        dom: 'B<"clear">lfrtip',
        columnDefs: [{
            "defaultContent": "None",
            render: function (data, type, full, meta) {
                if (type === 'copy') {
                    var api = new $.fn.dataTable.Api(meta.settings);
                    data = $(api.column(meta.col).header()).text() + ": " + data;
                }
                return data;
            }
        }],
        buttons: [{
            extend: 'copyHtml5',
            text: 'Copy Selected Rows',
            header: false,
            title: '',
            exportOptions: {
                modifier: {
                    selected: true
                },
                columns: ':visible',
                orthogonal: 'copy'
            }
        }, 'colvis'],
        "select": true,
        "lengthMenu": [ 10, 25, 50, 75, 100 ]
    });
} );
Albert Einstein
  • 7,472
  • 8
  • 36
  • 71
M.i. Sujon
  • 9
  • 2
  • 6

0 Answers0