Data table bulk actions Add-on
Extended functionality to component: Data table
Features
- Generate a user interface for selecting records.
- Enables you to perform actions to multiple records at once.
- Send
POSTrequests with data from thedata-idattribute of the selected records. - Works with all variants of the Data table component.
Configuration
- Include the compiled css file in the Html:
<link href="/css/components/data-table.bulk-actions.min.css" rel="stylesheet" /> - Include the compiled javascript file in the Html:
<script src="/javascript/data-table.bulk-actions.min.js"></script>
Implementation Javascript
Basic
Create a DataTableBulkActions object with minimal configuration and a single link:
const myDataTableBulkActions = new DataTableBulkActions({
input: '#myDataTable',
links: [
{
url: '/download',
text: 'Download'
}
]
});
Advanced
Create a DataTableBulkActions object with detailed configuration, other language (Swedish) and multiple links:
const myDataTableBulkActions = new DataTableBulkActions({
input: '#myDataTable',
hidden: true,
text: {
singleSelected: 'vald',
multipleSelected: 'valda',
noneSelected: 'ingen vald',
select: 'Välj',
show: 'Visa',
hide: 'Dölj'
},
links: [
{
url: '/download',
text: 'Ladda ned',
class: 'icon-download'
},
{
url: '/star',
text: 'Lägg till stjärna',
class: 'icon-star'
},
{
url: '/delete',
text: 'Ta bort',
class: 'icon-delete'
}
]
});
Examples
View source for Html code.