| [ Web Proxy ] |
| Viewing: https://adminforth.dev/docs/api/Back/interfaces/ResourceOptionsInput/ | [Back] [Original] |
General options for resource.
Omit<NonNullable<AdminForthResourceInputCommon["options"]>, "allowedActions" | "bulkActions" | "actions">
optionalactions?:AdminForthActionInput[]
Array of actions which will be displayed in the resource.
Example:
actions: [
{
name: 'Auto submit',
allowed: ({ adminUser, standardAllowedActions }) => {
return adminUser.dbUser.role === 'superadmin';
},
action: ({ adminUser, resource, recordId, adminforth, extra, tr }) => {
console.log("auto submit", recordId, adminUser);
return { ok: true, successMessage: "Auto submitted" };
},
showIn: {
list: true,
showButton: true,
showThreeDotsMenu: true,
},
},
]
optionalallowedActions?:AllowedActionsInput
Allowed actions for resource.
Example:
allowedActions: {
create: ({ resource, adminUser }) => {
// Allow only superadmin to create records
return adminUser.dbUser.role === 'superadmin';
},
delete: false, // disable delete action for all users
}
optionalbaseActionsAsQuickIcons?: ("show"|"edit"|"delete")[]
Show quick action icons for base actions (show, edit, delete) in list view. By default, they are inside three dots dropdown menu.
Omit.baseActionsAsQuickIcons
optionalbulkActions?:AdminForthBulkAction[]
Custom bulk actions list. Bulk actions available in list view when user selects multiple records by using checkboxes.
Since 2.26.5. Will be removed in 4.0.0. Use actions instead.
optionalcreateFieldGroups?:FieldGroup[]
Omit.createFieldGroups
optionaldefaultSort?:object
Default sort for list view. Example:
import { AdminForthSortDirections } from 'adminforth';
...
defaultSort: {
columnName: 'created_at',
direction: AdminForthSortDirections.ASC,
}
columnName:
string
Column name which will be used to sort records.
direction:
string
Direction of sorting. Can be 'asc' or 'desc'.
Omit.defaultSort
optionaldontShowWarningAboutUnsavedChanges?:boolean
If true, user will not see warning about unsaved changes when tries to leave edit or create page with unsaved changes. default is false
Omit.dontShowWarningAboutUnsavedChanges
optionaleditFieldGroups?:FieldGroup[]
Omit.editFieldGroups
optionalfieldGroups?:FieldGroup[]
Allows to make groups of columns in show, create and edit resource pages.
Omit.fieldGroups
optionallistBufferSize?:number
Buffer size for virtual scroll in list view.
Omit.listBufferSize
optionallistPageSize?:number
Page size for list view
Omit.listPageSize
optionallistPageSizeOptions?:number[] | ((args) =>number[] |Promise<number[]>)
Available page size options for list view, provided as an array of page sizes
or a function returning them. When set together with listPageSize, the page
size should be one of the values returned here.
Omit.listPageSizeOptions
optionallistRowsAutoRefreshSeconds?:number
Whether to refresh existing list rows automatically every N seconds.
Omit.listRowsAutoRefreshSeconds
optionallistTableClickUrl?: (record,adminUser,resource) =>Promise<string>
Callback to define what happens when user clicks on record in list view.
By default show view will be opened.
If you wish to open custom page, return URL to the custom page (can start with https://, or relative adminforth path)
If you wish to open page in new tab, add target=_blank get param to returned URL, example:
listTableClickUrl: async (record, adminUser, resource) => {
return `https://google.com/search?q=${record.name}&target=_blank`;
}
If you wish to do nothing on click, return null.
Example:
listTableClickUrl: async (record, adminUser, resource) => {
return null;
}
| Parameter | Type | Description |
|---|---|---|
record | any | record which was clicked |
adminUser | AdminUser | user who clicked |
resource | AdminForthResource | - |
Promise<string>
Omit.listTableClickUrl
optionallistVirtualScrollEnabled?:boolean
Whether to use virtual scroll in list view.
Omit.listVirtualScrollEnabled
optionalpageInjections?:object
Custom components which can be injected into AdminForth CRUD pages. Each injection is a path to a custom component which will be displayed in the admin panel. Can be also array to render multiple injections one after another.
Example:
pageInjections: {
list: {
beforeBreadcrumbs: '@@/Announcement.vue',
}
}
optionalcreate?:object
Custom components which can be injected into resource create page.
Component accepts next props: [resource, adminUser, meta]
optionalafterBreadcrumbs?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionalbeforeBreadcrumbs?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionalbottom?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionalthreeDotsDropdownItems?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionaledit?:object
Custom components which can be injected into resource edit page.
Component accepts next props: [record, resource, adminUser, meta]
optionalafterBreadcrumbs?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionalbeforeBreadcrumbs?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionalbottom?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionalthreeDotsDropdownItems?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionallist?:object
Custom components which can be injected into resource list page.
Component accepts next props: [resource, adminUser, meta]
optionalafterBreadcrumbs?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionalbeforeActionButtons?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionalbeforeBreadcrumbs?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionalbottom?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionalcustomActionIcons?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionalcustomActionIconsThreeDotsMenuItems?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionaltableBodyStart?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionaltableRowReplace?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionalthreeDotsDropdownItems?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionalshow?:object
Custom components which can be injected into resource show page.
Component accepts next props: [record, resource, adminUser, meta]
optionalafterBreadcrumbs?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionalbeforeBreadcrumbs?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionalbottom?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
optionalthreeDotsDropdownItems?:AdminForthComponentDeclaration|AdminForthComponentDeclaration[]
Omit.pageInjections
optionalshowFieldGroups?:FieldGroup[]
Omit.showFieldGroups
optionalshowNextButton?:boolean
Whether to show the "Next" navigation button on the show page.
Allows cycling through records respecting current list filters and sorting.
Defaults to true.
Omit.showNextButton
| Web Proxy Viewer | New URL | Original Page |