Export button to PDF/Excel etc and dropdown list

Export button to PDF/Excel etc and dropdown list

nkalexiounkalexiou Posts: 2Questions: 1Answers: 0
edited January 2016 in Free community support

Hello,

I have a table and one of the columns has a dropdown list with a set of options:

<td>
    <select name="customerType" id="customerTypeId">
        <option value="1">Option 1</option>
        <option value="2">Option 2</option>
        <option value="3" selected="selected">Option 3</option>
    </select>
</td>

When I use the export buttons I get the whole list of options for that particular column instead of only the selected option.

I initialize my table like this:

$('#table2').DataTable({ 
    paging: false,
    dom: 'Bfrtip',
    buttons: [
    'copyHtml5',
    'excelHtml5',
    'csvHtml5',
    'pdfHtml5'
    ]                                               
});

I want to export only the value that is selected. What can I do to fix this?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    There is currently no option for that in Buttons - sorry. You might be able to do it with orthogonal data and updated the data point when the value is changed, but there isn't a built in way of exporting the select list value.

    Allan

  • nkalexiounkalexiou Posts: 2Questions: 1Answers: 0

    Ok thanks for your reply! I'm thinking to create a custom button which will popup a new window with the html table format that Datatables can handle. Then it should be easy to export with Datatables.

This discussion has been closed.