Search code examples
javascripthtmltwitter-bootstrapbootstrap-table

Download Content from Bootstrap Table and Link Content to new page


I have a bootstrap table that looks like this:

<table style="width:90%" align="center" class="table table-bordered" id="example_table" data-toggle="table"
       data-url="example" data-search="true" data-show-columns="true">
    <thead>
    <tr>
        <th rowspan="3" data-field="name">Name</th>
        <th colspan="9" id="title">Title</th>
    </tr>
    <tr class="table_headers">
        <th colspan="3">Header 1</th>
        <th colspan="3">Header 2</th>
        <th rowspan="2" style="vertical-align: middle" data-field="header3">Header 3</th>
        <th rowspan="2" style="vertical-align: middle" data-field="header4">Header 4</th>
        <th rowspan="2" style="vertical-align: middle" data-field="header5">Header 5</th>
    </tr>
    <tr class="table_headers">
        <th data-field="sub1">Sub 1</th>
        <th data-field="sub2">Sub 2</th>
        <th data-field="sub3">Sub 3</th>
        <th data-field="sub4">Sub 4</th>
        <th data-field="sub5">Sub 5</th>
        <th data-field="sub6">Sub 6</th>
    </tr>
    </thead>
</table>

I want the user to be able to download this table in CSV format. I would also like to make anything in the "Name" a link to another page. How do I go about doing that?


Solution

  • Research datatables in general ('cos they are cool) and for your query specifically: https://datatables.net/extensions/buttons/examples/initialisation/export.html