2
<table>
    <thead>
        <tr>
            <th colspan="4" align="center">This is header</th>
        </tr>
        <tr>
            <th>S.No</th>
            <th>Class Name</th>
            <th>Section</th>
            <th>Enrollment Code</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1</td>
            <td>1st</td>
            <td>A</td>
            <td>101</td>
        </tr>
        <tr>
            <td>1</td>
            <td>1st</td>
            <td>A</td>
            <td>101</td>
        </tr>
    </tbody>
</table>

The above is my table with header colspan and rowspan, for the table i am adding data table plugin as below

$('table').DataTable({
            "scrollX": true,
            "paging": true,
            "bSort": false,
            "sScrollXInner": "100%",
            "lengthMenu": [[50, 100, 500, -1], ["50", "100", "500", "All"]],
            dom: 'Bfrtip',
            buttons: [
                'excelHtml5',
            ]
        });

while i am click on the export button it remove the first row and export remaining data how to allow the colspan and rowspan in export excel in datatable plugin. please help me.

5
  • See this -> stackoverflow.com/questions/40302985/… Commented Jul 20, 2017 at 7:48
  • in the link i have small doubt. there have two function one is _fnGetHeaders call from other function but where can i put second function(DataTable.ext.buttons.excelHtml5) Commented Jul 20, 2017 at 9:20
  • It is explained in the text: "Then I changed the code in DataTable.ext.buttons.excelHtml5 in the same file to:" ...It is BTW the only reasonable way. You will have to tweak the code. Commented Jul 20, 2017 at 9:46
  • sorry please explain in jsfiddle Commented Jul 20, 2017 at 9:49
  • addRow not a function Commented Jul 20, 2017 at 10:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.