{hero}

buttons.exportInfo()

Since: Buttons 1.4.0

Get export meta information that is common to many different button types.
Please note - this property requires the Buttons extension for DataTables.

Description

The most commonly used feature of Buttons is its ability to display buttons that export the data from the table - copy to clipboard, print or locally created data file. Each of the button types that provide this functionality has its own range of options (for example the CSV button type can have the field separator character modified to be a TSV export) in addition to options which are common to each of them. This method provides those common options, ensuring consistency in the API as well as code reuse.

Generally it is unlikely you would want to use this method outside of an export button, but it is publicly available for customised buttons.

Type

function buttons.exportInfo( [ options ] )

Description:
Parameters:
Returns:

An object which has the following parameters:

  • filename - File name that should be used for any file that is created by the button
  • messageTop - Message to be shown at the top of the exported data's content (after the title)
  • messageBottom - Message to be shown at the end of the exported data's content
  • title - Title to show in the exported data.

Example

Get export information in a custom button:

var table = new DataTable('#myTable', {
	buttons: [
		{
			text: 'My button',
			action: function (e, dt, button, config) {
				var info = dt.buttons.exportInfo();
				// Do something with the 'info' variable when creating custom export
			}
		}
	]
});