Enable Default Dropdown Actions

This extension will handle the "defaultRowAction" and "defaultBulkAction" data attributes of the table upon initialization or user click.

Options

Default Row Action | data-datatable_default_actions-row | String | Required

Provide the default row action. This will automatically be mapped to the defaultRowAction data value of the table.

Default Bulk Action | data-datatable_default_actions-bulk | String | Required

Provide the default bulk action. This will automatically be mapped to the defaultBulkAction data value of the table.

Bulk Action Selector | data-datatable_default_actions-bulk-action-selector | String | Optional

Provide a selector for the bulk action dropdown widget. The default value is '.bulk-action'.

Methods

Ensure Default Task

This method will make sure that there is a default task selected. Call it after you setup the row or bulk dropdown actions. Sometimes the user_configuration db value might contain a default value that is not present in the dropdowns anymore (e.g. removed module). In order to make sure that there will always be a default value use this method after creating the dropdown actions and it will use the first dropdown action as default if needed.

// Ensure default row actions.
$('.table-main').datatable_default_actions('ensure', 'row');

// Ensure default bulk actions.
$('.table-main').datatable_default_actions('ensure', 'bulk');
Source: