Skip to main content

ResourceOptionsInput

General options for resource.

Extends​

Properties​

actions?​

optional actions?: 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,
},
},
]

allowedActions?​

optional allowedActions?: 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
}

baseActionsAsQuickIcons?​

optional baseActionsAsQuickIcons?: ("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.

Inherited from​

Omit.baseActionsAsQuickIcons


bulkActions?​

optional bulkActions?: AdminForthBulkAction[]

Custom bulk actions list. Bulk actions available in list view when user selects multiple records by using checkboxes.

Deprecated​

Since 2.26.5. Will be removed in 4.0.0. Use actions instead.


createFieldGroups?​

optional createFieldGroups?: FieldGroup[]

Inherited from​

Omit.createFieldGroups


defaultSort?​

optional defaultSort?: object

Default sort for list view. Example:

import { AdminForthSortDirections } from 'adminforth';

...

defaultSort: {
columnName: 'created_at',
direction: AdminForthSortDirections.ASC,
}

columnName​

columnName: string

Column name which will be used to sort records.

direction​

direction: string

Direction of sorting. Can be 'asc' or 'desc'.

Inherited from​

Omit.defaultSort


dontShowWarningAboutUnsavedChanges?​

optional dontShowWarningAboutUnsavedChanges?: 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

Inherited from​

Omit.dontShowWarningAboutUnsavedChanges


editFieldGroups?​

optional editFieldGroups?: FieldGroup[]

Inherited from​

Omit.editFieldGroups


fieldGroups?​

optional fieldGroups?: FieldGroup[]

Allows to make groups of columns in show, create and edit resource pages.

Inherited from​

Omit.fieldGroups


listBufferSize?​

optional listBufferSize?: number

Buffer size for virtual scroll in list view.

Inherited from​

Omit.listBufferSize


listPageSize?​

optional listPageSize?: number

Page size for list view

Inherited from​

Omit.listPageSize


listPageSizeOptions?​

optional listPageSizeOptions?: 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.

Inherited from​

Omit.listPageSizeOptions


listRowsAutoRefreshSeconds?​

optional listRowsAutoRefreshSeconds?: number

Whether to refresh existing list rows automatically every N seconds.

Inherited from​

Omit.listRowsAutoRefreshSeconds


listTableClickUrl?​

optional listTableClickUrl?: (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;
}

Parameters​

ParameterTypeDescription
recordanyrecord which was clicked
adminUserAdminUseruser who clicked
resourceAdminForthResource-

Returns​

Promise<string>

Inherited from​

Omit.listTableClickUrl


listVirtualScrollEnabled?​

optional listVirtualScrollEnabled?: boolean

Whether to use virtual scroll in list view.

Inherited from​

Omit.listVirtualScrollEnabled


pageInjections?​

optional pageInjections?: 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',
}
}

create?​

optional create?: object

Custom components which can be injected into resource create page.

Component accepts next props: [resource, adminUser, meta]

create.afterBreadcrumbs?​

optional afterBreadcrumbs?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

create.beforeBreadcrumbs?​

optional beforeBreadcrumbs?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

create.bottom?​

optional bottom?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

create.threeDotsDropdownItems?​

optional threeDotsDropdownItems?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

edit?​

optional edit?: object

Custom components which can be injected into resource edit page.

Component accepts next props: [record, resource, adminUser, meta]

edit.afterBreadcrumbs?​

optional afterBreadcrumbs?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

edit.beforeBreadcrumbs?​

optional beforeBreadcrumbs?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

edit.bottom?​

optional bottom?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

edit.threeDotsDropdownItems?​

optional threeDotsDropdownItems?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

list?​

optional list?: object

Custom components which can be injected into resource list page.

Component accepts next props: [resource, adminUser, meta]

list.afterBreadcrumbs?​

optional afterBreadcrumbs?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

list.beforeActionButtons?​

optional beforeActionButtons?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

list.beforeBreadcrumbs?​

optional beforeBreadcrumbs?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

list.bottom?​

optional bottom?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

list.customActionIcons?​

optional customActionIcons?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

list.customActionIconsThreeDotsMenuItems?​

optional customActionIconsThreeDotsMenuItems?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

list.tableBodyStart?​

optional tableBodyStart?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

list.tableRowReplace?​

optional tableRowReplace?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

list.threeDotsDropdownItems?​

optional threeDotsDropdownItems?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

show?​

optional show?: object

Custom components which can be injected into resource show page.

Component accepts next props: [record, resource, adminUser, meta]

show.afterBreadcrumbs?​

optional afterBreadcrumbs?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

show.beforeBreadcrumbs?​

optional beforeBreadcrumbs?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

show.bottom?​

optional bottom?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

show.threeDotsDropdownItems?​

optional threeDotsDropdownItems?: AdminForthComponentDeclaration | AdminForthComponentDeclaration[]

Inherited from​

Omit.pageInjections


showFieldGroups?​

optional showFieldGroups?: FieldGroup[]

Inherited from​

Omit.showFieldGroups


showNextButton?​

optional showNextButton?: 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.

Inherited from​

Omit.showNextButton