$.fn.dataTable.fileSave()

Since: Buttons 1.2.0

Save a file that has been created on the client-side. Please note - this property requires the Buttons extension for DataTables.

Description

Buttons makes use of Eli Grey's outstanding FileSaver.js library in order to be able to provide its client-side file creation and download methods. This method exposes Button's built in FileSaver.js so you can use it in other applications, or for custom buttons.

For full details of how to use FileSaver, please refer to the FileSaver.js documentation.

Please note that Safari currently has very limited support for creating files on the client-side due to this Webkit bug 156056. Additionally, IE9 and earlier are not supported. Again, for full details, please refer to the FileSaver.js documentation - this method simply exposes that library!

Type

function fileSave( data, filename [, disableAutoBOM )

Description:

Create and download a file on the client-side using information passed to this method.

Example

Set a simple action function for button index 0:

var table = $('#myTable').DataTable();

table.button( 0 ).action( function( e, dt, button, config ) {
	console.log( 'Button '+this.text()+' activated' );
	this.disable();
} );