{hero}

buttons.buttons.init

Since: Buttons 1.0.0

Initialisation function that can be used to add events specific to this button.
Please note - this property requires the Buttons extension for DataTables.

Example

Enable / disable based on there being selected rows (from the Select extension):

new DataTable('#myTable', {
	layout: {
		topStart: 'buttons'
	},
	buttons: [
		{
			text: 'Enabled only with selected item',
			init: function (dt, node, config) {
				var that = this;

				dt.on('select.dt.DT deselect.dt.DT', function () {
					that.enable(dt.rows({ selected: true }).any());
				});

				this.disable();
			}
		}
	]
});