Basic initialization
The HTML5 export buttons plug-in for Buttons provides four export buttons:
copyHtml5
- copy to clipboard; csvHtml5
- save to CSV file; excelHtml5
- save to XLSX file (requires JSZip); pdfHtml5
- save to PDF file (requires PDFMake). This example demonstrates these four button types with their default options. Please note that these button types may also use a Flash fallback for older browsers (IE9-).
First Name | Last Name | Job Title | DOB | Status | Salary |
---|---|---|---|---|---|
Marth | Enright | Traffic Court Referee | 22 Jun 1972 | Active | $85,600 |
Jackelyn | Weible | Airline Transport Pilot | 3 Oct 1981 | Inactive | $106,450 |
Aura | Hard | Business Services Sales Representative | 19 Apr 1969 | Suspended | $237,500 |
Nathalie | Pretty | Drywall Stripper | 13 Dec 1977 | Pending | $198,500 |
Sharan | Leland | Aviation Tactical Readiness Officer | 30 Dec 1991 | Inactive | $470,600 |
Maxine | Woldt | Business Services Sales Representative | 17 Oct 1987 | Pending | $90,560 |
Sylvia | Mcgaughy | Hemodialysis Technician | 11 Nov 1983 | Suspended | $103,600 |
Lizzee | Goodlow | Technical Services Librarian | 1 Nov 1961 | Suspended | $205,500 |
Kennedy | Haley | Senior Marketing Designer | 18 Dec 1960 | Active | $137,500 |
Chantal | Nailor | Technical Services Librarian | 10 Jan 1980 | Inactive | $372,000 |
Delma | Bonds | Lead Brand Manager | 21 Dec 1968 | Pending | $162,700 |
Roland | Salmos | Senior Program Developer | 5 Jun 1986 | Inactive | $433,060 |
Coy | Wollard | Customer Service Operator | 12 Oct 1982 | Active | $86,000 |
Maxwell | Maben | Regional Representative | 25 Feb 1988 | Suspended | $130,500 |
Cicely | Sigler | Senior Research Officer | 15 Mar 1960 | Pending | $159,000 |
PDF with image
The
pdfHtml5
button will generate a document description object which you then have the option to customise through the button's customize
option. This parameter should be given as a function and is given a single parameter - the object that the button as created with the table already populated. That object can then be modified - please refer to the PDFMaker documentation for full details of how the PDF can be customised.
First Name | Last Name | Job Title | DOB | Status | Salary |
---|---|---|---|---|---|
Marth | Enright | Traffic Court Referee | 22 Jun 1972 | Active | $85,600 |
Jackelyn | Weible | Airline Transport Pilot | 3 Oct 1981 | Inactive | $106,450 |
Aura | Hard | Business Services Sales Representative | 19 Apr 1969 | Suspended | $237,500 |
Nathalie | Pretty | Drywall Stripper | 13 Dec 1977 | Pending | $198,500 |
Sharan | Leland | Aviation Tactical Readiness Officer | 30 Dec 1991 | Inactive | $470,600 |
Maxine | Woldt | Business Services Sales Representative | 17 Oct 1987 | Pending | $90,560 |
Sylvia | Mcgaughy | Hemodialysis Technician | 11 Nov 1983 | Suspended | $103,600 |
Lizzee | Goodlow | Technical Services Librarian | 1 Nov 1961 | Suspended | $205,500 |
Kennedy | Haley | Senior Marketing Designer | 18 Dec 1960 | Active | $137,500 |
Chantal | Nailor | Technical Services Librarian | 10 Jan 1980 | Inactive | $372,000 |
Delma | Bonds | Lead Brand Manager | 21 Dec 1968 | Pending | $162,700 |
Roland | Salmos | Senior Program Developer | 5 Jun 1986 | Inactive | $433,060 |
Coy | Wollard | Customer Service Operator | 12 Oct 1982 | Active | $86,000 |
Maxwell | Maben | Regional Representative | 25 Feb 1988 | Suspended | $130,500 |
Cicely | Sigler | Senior Research Officer | 15 Mar 1960 | Pending | $159,000 |
Column selectors
All of the data export buttons have a
exportOptions
option which can be used to specify information about what data should be exported and how. In this example the copy button will export column index 0 and all visible columns, the Excel button will export only the visible columns and the PDF button will export column indexes 0, 1, 2 and 5 only. Column visibility controls are also included so you can change the columns easily.
First Name | Last Name | Job Title | DOB | Status | Salary |
---|---|---|---|---|---|
Marth | Enright | Traffic Court Referee | 22 Jun 1972 | Active | $85,600 |
Jackelyn | Weible | Airline Transport Pilot | 3 Oct 1981 | Inactive | $106,450 |
Aura | Hard | Business Services Sales Representative | 19 Apr 1969 | Suspended | $237,500 |
Nathalie | Pretty | Drywall Stripper | 13 Dec 1977 | Pending | $198,500 |
Sharan | Leland | Aviation Tactical Readiness Officer | 30 Dec 1991 | Inactive | $470,600 |
Maxine | Woldt | Business Services Sales Representative | 17 Oct 1987 | Pending | $90,560 |
Sylvia | Mcgaughy | Hemodialysis Technician | 11 Nov 1983 | Suspended | $103,600 |
Lizzee | Goodlow | Technical Services Librarian | 1 Nov 1961 | Suspended | $205,500 |
Kennedy | Haley | Senior Marketing Designer | 18 Dec 1960 | Active | $137,500 |
Chantal | Nailor | Technical Services Librarian | 10 Jan 1980 | Inactive | $372,000 |
Delma | Bonds | Lead Brand Manager | 21 Dec 1968 | Pending | $162,700 |
Roland | Salmos | Senior Program Developer | 5 Jun 1986 | Inactive | $433,060 |
Coy | Wollard | Customer Service Operator | 12 Oct 1982 | Active | $86,000 |
Maxwell | Maben | Regional Representative | 25 Feb 1988 | Suspended | $130,500 |
Cicely | Sigler | Senior Research Officer | 15 Mar 1960 | Pending | $159,000 |
Tab separated values
The
copyHtml5
and csvHtml5
buttons have the option to specify the character that separates the values between fields. By default this is a tab character for the copy button, but the Comma Separated Values button uses a comma. In this example the exported file is a tab separated values file. The file extension has also been set to reflect this, although that is optional as most spreadsheet applications will read TSV files without issue.
First Name | Last Name | Job Title | DOB | Status | Salary |
---|---|---|---|---|---|
Marth | Enright | Traffic Court Referee | 22 Jun 1972 | Active | $85,600 |
Jackelyn | Weible | Airline Transport Pilot | 3 Oct 1981 | Inactive | $106,450 |
Aura | Hard | Business Services Sales Representative | 19 Apr 1969 | Suspended | $237,500 |
Nathalie | Pretty | Drywall Stripper | 13 Dec 1977 | Pending | $198,500 |
Sharan | Leland | Aviation Tactical Readiness Officer | 30 Dec 1991 | Inactive | $470,600 |
Maxine | Woldt | Business Services Sales Representative | 17 Oct 1987 | Pending | $90,560 |
Sylvia | Mcgaughy | Hemodialysis Technician | 11 Nov 1983 | Suspended | $103,600 |
Lizzee | Goodlow | Technical Services Librarian | 1 Nov 1961 | Suspended | $205,500 |
Kennedy | Haley | Senior Marketing Designer | 18 Dec 1960 | Active | $137,500 |
Chantal | Nailor | Technical Services Librarian | 10 Jan 1980 | Inactive | $372,000 |
Delma | Bonds | Lead Brand Manager | 21 Dec 1968 | Pending | $162,700 |
Roland | Salmos | Senior Program Developer | 5 Jun 1986 | Inactive | $433,060 |
Coy | Wollard | Customer Service Operator | 12 Oct 1982 | Active | $86,000 |
Maxwell | Maben | Regional Representative | 25 Feb 1988 | Suspended | $130,500 |
Cicely | Sigler | Senior Research Officer | 15 Mar 1960 | Pending | $159,000 |