Datatables - Buttons Init
This example shows the
copy
, csv
, excel
, pdf
and print
buttons being used to display data export options. Buttons can be initialised very easily though the buttons
object which can be given as an array of the buttons that you wish to display. The B
option in the dom
parameter will instruct DataTables where the buttons should be placed in the document - in this case, at the top right.
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 |
This example shows a single button that is specified using the
buttons.buttons.text
and buttons.buttons.action
parameters only - it simply shows an alert when activated, but any Javascript function could be run when the button is activated. All parameters are optional, and each plug-in button type can also specify its own parameters. Also this example shows how buttons can have optional classes.
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 |
This simple example shows a collection with two custom buttons. This collection button provides the ability to show a list of buttons when activated. The buttons it will display in the sub-list are defined by its
buttons
property which can take all of the same button options as the buttons.buttons
array (which the exception of another collection - collections cannot be nested).
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 |
This example shows the
pageLength
button being used with lengthMenu
to specify page lengths of 10, 25, 50 and all rows, with language strings used for the buttons. The pageLength
button acts in exactly the same way as the default length list and will inherit the options specified by the lengthMenu
option. Dropdown menu uses default Bootstrap styling and control button style if fully configurable through options.
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 |