recordIdparameter, meaning they are related to your resource as a whole and not to a specific record.
listis responsible for listing records under a resource as well as filtering them
searchallows you to search records in a given resource by a query string (by default it's the title property)
newis responsible for creating a new record in a given resource
recordIdparameter. They are related to a specific record.
showis responsible for showing the details of a record
editallows you to modify a specified record
deleteis responsible for deleting single records
recordIdsparameter which is a list of records' ids.
bulkDeleteremoves all selected records from the database
actionTypewhich can be
bulk. You also must define a
handlerfor your action. This is a backend method for fetching or processing your data. A single
handleris used for both querying and mutating processes but you are able to differentiate these based on
recordsin case of
recordactions. You can return any additional information alongside
component. This can either be
falsewhich means that the backend
handlerwill be triggered once you press the button or you can provide your custom component that will be rendered.
isVisibleoption or change it's accessibility by using
isAccessibleoption. Their configuration is the same, they can be just a boolean value:
IsFunctionwhich allows you to access record's context:
recordactions the accessibility and visibility checks are done in runtime, for example when loading a specific record.
Resourceactions' accessibility and visibility is evaluated when your AdminJS instance is created.
Filterbutton which you may have noticed above the table of the default
listaction can also be shown on your own
resourceactions' pages. However, by default it is disabled. If you would like the
Filterbutton to be present you should use
showFilteroption. The filters work exactly the same as in the
listaction - when you set them, they are appended to your browser's address and it is up to you to process assigned filters in your resource action's component.
showFilteroption can also be used to hide the filters for
Delete, a browser's confirmation pop-up appears asking you to confirm the removal of a record. If you want a similar behaviour in your custom actions, you should use
guardmessage goes through localization so you can use a translation key.
handleryou can also define
afterhooks in your custom or existing actions. The
beforehook is triggered at the start of an action, before
afterhook, in turn, is triggered at the end of an action.
listaction to set default filter that only shows
Userresource results which have
active. Additionally, we will use
metaproperty of the response returned by
afteroptions accept a list of
Afterfunctions. This means you can assign multiple
afterhooks to your action where their order is important because every hook uses the arguments that could have been modified by the previous ones.
beforehook can also be used to add additional validation for example in your
Filtersdrawer is opened. This can be achieved by using
parentoption can be a solution for you. This option allows you to set a name of a dropdown button which will group those actions under it.
myOtherCustomActionwhich both are grouped under