In every database application we want to have the possibility do do someting with our data.
The buttons setting should be enable you to create in a standardized way.
Parameters:
- Form
- Min. Userrole
- Type
- Title
- Tooltip-Text
- fa-icon
- CSS Class
- Action
- Payload
- Custom JS-Function
- Sort Order
Form:
If an button click should do an create or edit action, we have to open a form. Here you can define which one. This enable you to use different forms for different actions if the data is mapped from the table to both forms.
Types:
- Default
Display the Button above the table like create buttons or custom actions - Form
Display the button in the row, so the button relates to the data row, like edit or delete an entry.
This also works for subtables - Bulk
A toolbar action that operates on several selected rows at once. Adding a Bulk-type button automatically turns on the DataTable’s multi-select column (see Bulk Selection below): a per-row checkbox and a select-all checkbox in the header. The button’s action collects the checked row ids via the globalgetSelectedEntriesForBulkAction(dataTableId)helper. - FormDataTable Specific
- header-csv – maps to the datatable.net csv export setting
- header-pdf – maps to the datatable.net csv export setting
- header-excel – maps to the datatable.net excel export setting
Scope
- GLOBAL – HEADER
- Display Button in Form TOP or DataTable TOP
- GLOBAL – FOOTER
- Display Button in Form Footer
- LOCAL
- Display Button in DataTable Row for each Entry
Bulk Selection
When a DataTable has at least one Bulk-type button, the renderer adds a dedicated multi-select column:
- a per-row checkbox (class
<tableId>-bulk, carrying the row id in itsdata-id), and - a select-all checkbox in the column header (id
<tableId>-bulk-all) that toggles every visible row checkbox.
A Bulk-action handler reads the currently selected ids with the global helper:
var ids = getSelectedEntriesForBulkAction('<tableId>'); // -> [12, 18, 25, …]Notes:
- The column is emitted whenever a Bulk button is present, independent of the
button’s scope (a Bulk button itself is normally a
GLOBAL – HEADERtoolbar button). - Both the native (DS2) renderer and the legacy renderer produce the same
checkbox column, header and
getSelectedEntriesForBulkActioncollector, so Bulk buttons behave identically on either render path.
Title
Button-Title
Tooltip-Text
Button tooltip text
fa-icon:
We include font-awesome as our default icon libaray, so you can insert here te font awesome class.
CSS Class:
Here you can provide the class for the buttons. We inclode the bootstrap library, so you could use bootstrap classes like btn btn-primary …
Actions:
To define which function should be called after the button click, we provide a default interface to register actions. See Action section.
Actions:
To define which function should be called after the button click, we provide a default interface to register actions. See Action section.
Payload: (DEPRECATED)
In some special cases we want to provide the action more information. Here you could add data in json style like follows:
"identifier":"pdf_a", "filename":"export.pdf"Example: Option: onclick with code
jQuery('###datatable_identifier##').DataTable().ajax.reload();Sort Order:
This defines the order of the displayed buttons
Options:
-
add_entity_to_update : true – Updates Datatables with Entity after Submit
-
add_parent_entity_to_update : true – Updates Datatables with Parent Entity after Submit
-
class_column
This allows referring to a select field of the query, for example, if the query result has a column namedcalculated_css_class, then this option can be used to assign the value of that class.
key: class_column, value:calculated_css_class -
parent_form_identifier
-
tooltip_column
- key: tooltip_column, value: column_name
- The same principle as
class_columnis applied here.
-
id_column
- Default ID Column is the row id. If you what to use another id column you can set it:
- key: id_column, value: column_name
- Default ID Column is the row id. If you what to use another id column you can set it:
-
create_as_entity
