Option wpda_buttons_custom allows plugin users to add standard and custom buttons to a data table. The following advanced settings adds three buttons to my data table. A custom button calling a custom function and two standard buttons with custom labels. The inline demo below shows the result.
{
"dom": "Bfrtip",
"wpda_buttons_custom": [
{
"text": "Custom Button",
"action": "function ( e, dt, node, config ) { alert('call your own javascript function here'); }"
},
{
"text": "Print selected rows",
"extend": "print"
},
{
"text": "Export to CSV",
"extend": "csv"
}
]
}
Inline demo #
ID | Gender | Date Of Birth | Firstname | Lastname | Address | Zipcode | City | County | Country | Phone No | Registration Date | Student Wp Username | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ID | Gender | Date Of Birth | Firstname | Lastname | Address | Zipcode | City | County | Country | Phone No | Registration Date | Student Wp Username |
More information about this topic can be found here:
A WP Data Access example can be found here:
Use the Code Manager to add your javascript function to your web page:
Button labels #
Button labels are show in uppercase by default. You can change this in your css.
.dt-button {
text-transform: inherit;
}
Note #
- Custom buttons are shown in the order in which they are added to the custom button array