0

I would like to implement an excel export button to my table but i have no idea how to do it using only jquery. Here is a screenshot of the table. I want a button next to those in yellow color. Also, since there are a lot of columns (hidden) I want to export only the visible columns

enter image description here

Here is my table settings:

<div id="someTable">
        <table id="table1" class="table table-hover table-data tab1" style="font-size: 0.8em;"
            data-pagination="true"
            data-search="true"
            data-show-toggle="true"
            data-show-columns="true"
            data-show-export="true"
            data-filter-control="true"
            data-minimum-count-columns="2"
            data-show-pagination-switch="true"
            data-id-field="ID"
            data-page-list="[10, 25, 100, ALL]"
            >
        </table>
    </div>
Mark Fitzgerald
  • 3,048
  • 3
  • 24
  • 29

2 Answers2

0

Export to Excel isn't something you'll be able to fully accomplish in jQuery alone. If you're content with CSV files instead of actual XLS files you can use something like this gist which was an answer to another SO question.

However, if you're hoping to export to native Excel format so you can get formatting, formulas, etc, you'll need to do that in a backend script on your server in a language such as PHP, C#, etc. In that case you'll have to pass the parameters for your export (such as the desired columns to export) to your server-side script.

davidethell
  • 11,708
  • 6
  • 43
  • 63
0

The issue was that I had missing references to JS files and I had to download and import them. This is a bootstrap table and there is no need of server-side code. It is done only using jquery