dile-crud-actions
The dile-crud-actions component is responsible for displaying and processing batch actions that can be performed on CRUD elements.
Normally, you don't need to use this component on its own, as it is used internally by the dile-crud component to handle batch actions. However, we document it because you might want to listen to the custom events it dispatches, in order to display corresponding feedback messages to the user.
Properties
-
fullWidth: Boolean, reflected as the
full-widthattribute. Whentrue, the "Actions" button that opens the batch actions menu takes the full available width and always shows its label (also on small screens, where the icon-only version is used otherwise).dile-crud-singleenables it automatically in thesidebarlayout. Default:false. -
maxItems: Number. Maximum number of selected items an action accepts. When
actionIdshas more, the actions menu shows a warning and the run button is disabled.dile-crudsets it from the list'sbatchLimit. Default:undefined(no limit). -
validationSchemas: Object, validation rules of the action forms by action name,
{ ActionName: { field: rules } }. Each form receives its schema withsetValidationSchema()(needs the DileFormValidation mixin).dile-crudanddile-crud-singleset it fromconfig.validation.actions. -
validationMessages: Object, validation messages for the action forms.
dile-crudsets it fromconfig.validation.messages.
Validation of the action forms
When the user accepts an action, its form is validated with its validate() method, if it has one (forms with the DileForm mixin). If it is not valid, the action is not sent, the confirm dialog stays open with the errors in the fields and crud-action-invalid is dispatched.
Custom Events
- crud-action-requested: This custom event is dispatched when the user requests to open an action form. It fires when clicking on the "Run action" button. The event detail includes the following data:
{
action, // The name of the action that was requested to be opened.
}
- crud-action-success: This custom event is dispatched after receiving a positive response from the server when processing an action. The event detail includes the following data:
{
msg, // The message returned by the server.
action, // The name of the action that was processed, useful as certain actions may require response behaviors like interface refreshes or redirections.
data: // Additional data that may be returned by the server.
}
- crud-action-invalid: Dispatched when the action is not sent because its form is not valid. The event detail includes the following data:
{
action, // The name of the action.
errors, // The errors object, { fieldName: message }.
}
- crud-action-error: This custom event is dispatched when there is an error in processing the action by the server. The event detail includes the following data:
{
msg, // The message returned by the server.
errors, // The validation errors, { fieldName: message } (first message of each field)
}
dile-components