Datatables - Print Buttons
This simple example shows Buttons configured with the
print
button type only. The print button will open a new window in the end user's browser and, by default, automatically trigger the print function allowing the end user to print the table. The window will be closed once the print is complete, or has been cancelled. Also you can disable auto printing option (see the example below).
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 |
By default, when the print button opens the print view window it will automatically call the browser's
window.print()
method to present the browser's print dialogue box to the end user and they can set the options they wish. When the print action is confirmed or cancelled the print view window is then automatically closed. If this is not what you want, you can easily disable this behaviour by setting autoPrint
option to false
.
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 |
The
exportOptions.columns
option of the print
button provides the ability to select only certain columns (using a column-selector
). In this example only the visible columns are used for the printing. The column visibility buttons (colvis
) are included in this example so the column visibility can be easily changed. Additionally, the last column in the table is hidden by default (columns.visible
).
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 |
The print button provides a lot of flexibility in the selection of the data that is to be exported. In this example the Select extension for DataTables is used to give the end user the ability to select rows by clicking on them. Two print buttons are utilised in this example to demonstrate the
exportOptions
option: the first button will print all rows (after filtering); the second button will print only the selected rows.
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 |