Mail: [email protected] Phone: +1(424)231-4091

{namespace}-crud-actions

Every crud instance provides a capacity to extends the actions available for each row on the table. The basic actions provided on each Crud instance is: "edit" and "delete".

How To Add New Actions

Now let's assume you would like to add a new row action, that can be "duplicate" or "transfer", you'll need to use the filter "{namespace}-crud-actions" where "namespace" is the crud instance namespace. Here is how you'll register your custom action.

It's important to remind that an action can have various purposes. Usually, an action can be a link that takes to another page. In that specific case, the action must have the attribute "type" set to "GOTO". If the actions are mean to open a popup, then the type should be set to "POPUP". The "type" action is actually required. The URL defined on that action will be used to take the user to that location. Regarding the icons, you need to use the available icons listed here (use HTML tags).

If instead of redirecting the user you would like to process the request asynchronously, you might need to provide a new attribute "confirm". That new "attribute" must have a member "message", that should clearly explain what will happen by requiring the user consent.

Here, the "type" attribute might be "GET", "POST", "DELETE" or "PUT" to customize the request verb.

How To Edit Existing Actions

The same technique can be used to disable existing action or conditionally display them based on certain permissions for example. As the first parameter is the row itself, we can loop over the "$actions" property. To identify an option, we'll use the "namespace" attribute. Concretely here is how we can remove the "delete" option from a Crud instance.