Skip to main content

FrontendAPIInterface

Properties

list

list: object

clearFilters()

Clear all filters from the list

Returns

void

closeThreeDotsDropdown()

Close the three dots dropdown

Returns

void

refresh()

Full refresh the list. Loader will be shown during fetching data. Will fully reload table data from the server. If new data available, it will be shown in the list.

Returns

Promise<object>

error?

optional error: string

setFilter()

Set a filter in the list. Works only when user located on the list page. If filter already exists, it will be replaced with the new one. Can be used to set filter from charts or other components in pageInjections.

Filters are automatically marked as hidden (won't count in badge) if:

  • Column has showIn.filter: false

Example:

import adminforth from '@/adminforth'

// Regular filter (will show in badge if column.showIn.filter !== false)
adminforth.list.setFilter({field: 'name', operator: 'ilike', value: 'john'})

// Hidden filter (won't show in badge if column.showIn.filter === false)
adminforth.list.setFilter({field: 'internal_status', operator: 'eq', value: 'active'})

Please note that you can set/update filter even for fields which have showIn.filter=false in resource configuration. Also you can set filter for virtual columns. For example Universal search plugin calls updateFilter for virtual column which has showIn.filter=false (because we dont want to show this column in filter dropdown, plugin renders its own filter UI)

Parameters
ParameterTypeDescription
filterFilterParamsThe filter to set
Returns

void

silentRefresh()

Silently Refresh existing rows in the list (without loader). Should be called when table data already loaded, otherwise method will return an error. If new data available, it will not appear in the list.

Returns

Promise<object>

error?

optional error: string

silentRefreshRow()

Refresh a specific row in the list without loader, row should be already shown in the list, otherwise method will return an error

Parameters
ParameterType
pkany
Returns

Promise<object>

error?

optional error: string

updateFilter()

DEPRECATED: does the same as setFilter, kept for backward compatibility Update a filter in the list

Filters visibility in badge is automatically determined by column configuration:

  • Hidden if column has showIn.filter: false

Example:

import adminforth from '@/adminforth';

adminforth.list.updateFilter({field: 'name', operator: 'ilike', value: 'john'})
Parameters
ParameterTypeDescription
filterFilterParamsThe filter to update
Returns

void


menu: object

refreshMenuBadges()

Refreshes the badges in the menu, by recalling the badge function for each menu item

Returns

void


show

show: object

refresh()

Full refresh the current record on the show page. Loader may be shown during fetching. Fire-and-forget; you don't need to await it.

Returns

void

Methods

alert()

alert(params): string | void | Promise<string>

Show an alert

The alert will be displayed to the user

Example:

import adminforth from '@/adminforth'

adminforth.alert({message: 'Hello', variant: 'success'})

Parameters

ParameterTypeDescription
paramsAlertParamsThe parameters of the alert

Returns

string | void | Promise<string>


closeUserMenuDropdown()

closeUserMenuDropdown(): void

Close the user menu dropdown

Returns

void


confirm()

confirm(params): Promise<boolean>

Show a confirmation dialog

The dialog will be displayed to the user

Example:

import adminforth from '@/adminforth'

const isConfirmed = await adminforth.confirm({message: 'Are you sure?', yes: 'Yes', no: 'No'})
if (isConfirmed) {
your code...
}

Parameters

ParameterTypeDescription
paramsConfirmParamsThe parameters of the dialog

Returns

Promise<boolean>

A promise that resolves when the user confirms the dialog