buttons.info()
Display and hide information for the end user in a modal box.
Please note - this property requires the Buttons extension for DataTables.
Description
When using Buttons you may find you wish to indicate to the end user that an action has been performed when a button has been clicked on. This might be a simple information message stating what has happened based on the button action, or can be more complex and potentially include complex data input / output. For example, in the copy to clipboard button this is used to inform the user that the copy has occurred - otherwise they wouldn't know as the action happens without user notification.
This method provides a very simple way to display a modal box presenting the end user with information.
Although specifically designed for use with Buttons, this method can be used externally to the Buttons actions should you wish to display a message to the end user.
Type
buttons.info( title [, message [, time ]] )
Display / hide an information message to the end user to indicate that something has happened.
Parameters:
Name | Type | Optional | |
---|---|---|---|
1 | title | No | |
Message title. This will be shown in a This parameter can also be used to remove the information message by passing | |||
2 | message | Yes | |
Message to show to the end user. This is shown in a | |||
3 | time | Yes | |
When set the message will be removed automatically after this amount of time. The unit of time is milliseconds. If not given, or the value is 0, the message will be shown indefinitely until hidden with this method ( |
Returns:
DataTables.Api
DataTables API instance for chaining.
Examples
Display a notification message for 3 seconds:
var table = new DataTable('#myTable');
table.buttons.info('Notification', 'This is a notification message!', 3000);
Set a button's action to show a loading message, and then a done message when an Ajax process completes:
var table = new DataTable('#myTable');
table.button(0).action(function () {
table.buttons.info('Please wait', 'Processing data...');
$.ajax({
// ...
success: function () {
table.buttons.info('Complete', 'Data processing complete', 2000);
}
});
});