Exporting data in custom format

Exporting data in custom format

n403729w735708n403729w735708 Posts: 26Questions: 6Answers: 4

Having trouble finding documentation for exporting customized data. I have a table with rows and child rows I wish to export the data with customized column headers and specified content for those columns. Ideally, I'd like csv format but if this is not possible I'll take a look at any documentation or examples. Can someone please provide a reference?

Thank you

This question has an accepted answers - jump to answer

Answers

  • n403729w735708n403729w735708 Posts: 26Questions: 6Answers: 4

    Found a way to export the columns I need but it's exporting all columns which is not what I want. I've tried to specify the column indexes and then class names but the result is the same. Most of the columns I'm exporting are not visible so there is a mixture in that regard.

    buttons: [
    {
    extend: 'csvHtml5',
    text: 'csv visible rows',
    filename: 'OASISHistoryExport_'+moment().format('YYYY-MM-DD_HH-mm-ss'),
    exportOptions: {
    modifier: {
    search: 'none',
    //columns: [2,3,4,5,6,7,8,9,10,11,13,14,15,16,17,18,20,21,22,23,25,26,27,28,29,30,31,32,33,36,37]
    columns: '.exp'
    }
    }
    }
    ]

  • n403729w735708n403729w735708 Posts: 26Questions: 6Answers: 4
    Answer ✓

    Figured it out. Had columns in the wrong block. It should be:
    buttons: [
    {
    extend: 'csvHtml5',
    text: 'csv visible rows',
    filename: 'OASISHistoryExport_'+moment().format('YYYY-MM-DD_HH-mm-ss'),
    exportOptions: {
    modifier: {
    search: 'none'
    },
    //columns: [2,3,4,5,6,7,8,9,10,11,13,14,15,16,17,18,20,21,22,23,25,26,27,28,29,30,31,32,33,36,37]
    columns: '.exp'
    }
    }
    ]

  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin

    Thanks for posting back. Good to hear you have this working now.

    Allan

This discussion has been closed.