Thursday, 9 June 2016

How to export Bootstrap Data table all rows to excel?




Step 1:-
Take a save button on table and assign id


<table id="example2" class="table table-bordered table-hover" >
    <thead>
        <tr>
            <th>S.No.</th>
            <th>Date</th>
            <th>Process</th>
            <th>count</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1<td>
            <td>2015-11-04<td>
            <td>Java<td>
            <td>10<td>
        </tr>
    </tbody>
    <tfoot class="bg-gray">
        <tr>
            <th colspan="3">Summary</th>
            <th>10</th>
        </tr>
    </tfoot>
<table>
    <button id="button">save</button>


Step 2:-Now put javascript code

$('button').click(function(){
$("#example2").table2excel({
                    exclude: ".noExl",
                    name: "Excel Document Name",
                    filename: "myFileName",
                    exclude_img: true,
                    exclude_links: true,
                    exclude_inputs: true
})

    });


Thanks
Keep Happy Learning....

No comments:

Post a Comment