AdminForthResourceColumnCommon
Column describes one field in the table or collection in database.
Extends
Extended by
Properties
_underlineType?
optional
_underlineType:string
Internal type which indicates original type of column in database.
allowMinMaxQuery?
optional
allowMinMaxQuery:boolean
Whether AdminForth will show this field in list view.
Inherited from
AdminForthResourceColumnInputCommon
. allowMinMaxQuery
backendOnly?
optional
backendOnly:boolean
if true field will !not be passed to UI under no circumstances, but will be presented in hooks
Inherited from
AdminForthResourceColumnInputCommon
. backendOnly
components?
optional
components:AdminForthFieldComponents
Custom components which will be used to render this field in the admin panel.
Inherited from
AdminForthResourceColumnInputCommon
. components
editReadonly?
optional
editReadonly:boolean
Whether AdminForth will allow to edit this field in editing mode.
Inherited from
AdminForthResourceColumnInputCommon
. editReadonly
editingNote?
optional
editingNote:string
|object
Whether AdminForth will show editing note near the field in edit/create form.
Inherited from
AdminForthResourceColumnInputCommon
. editingNote
enforceLowerCase?
optional
enforceLowerCase:boolean
Will automatically convert any capital letters to lowercase in input during editing
Inherited from
AdminForthResourceColumnInputCommon
. enforceLowerCase
enum?
optional
enum:AdminForthColumnEnumItem
[]
Enum of possible values for this field.
Inherited from
AdminForthResourceColumnInputCommon
. enum
extra?
optional
extra:object
An optional configuration object for extra settings.
jsonCollapsedLevel?
optional
jsonCollapsedLevel:number
How many levels of JSON should be collapsed.
0
means - root level will be already collapsed e.g. {a:1}
will show {...}
where '...'
is clickable
1
means - root level will be shown, but next sub-level will be collapsed e.g. {a: {b: 1}}
will show {a: ...}
where '...'
is clickable
Default is 1.
Inherited from
AdminForthResourceColumnInputCommon
. extra
fillOnCreate?
optional
fillOnCreate:Function
Whether AdminForth will show this field in show view.
Inherited from
AdminForthResourceColumnInputCommon
. fillOnCreate
foreignResource?
optional
foreignResource:AdminForthForeignResourceCommon
Foreign resource which has pk column with values same that written in this column.
Inherited from
AdminForthResourceColumnInputCommon
. foreignResource
isUnique?
optional
isUnique:boolean
Whether AdminForth will request user to enter unique value during creating or editing record. This option causes AdminForth to make a request to database to check if value is unique. (Constraints are not used, so for large-tables performance make sure you have unique index in database if you set this option to true)
Inherited from
AdminForthResourceColumnInputCommon
. isUnique
label?
optional
label:string
How column can be labled in the admin panel. Use it for renaming columns. Defaulted to column name with Uppercased first letter.
Inherited from
AdminForthResourceColumnInputCommon
. label
masked?
optional
masked:boolean
Masked fields will be displayed as *****
on Edit and Create pages.
Inherited from
AdminForthResourceColumnInputCommon
. masked
max?
optional
max:number
Inherited from
AdminForthResourceColumnInputCommon
. max
maxLength?
optional
maxLength:number
Maximum length of string that can be entered in this field.
Inherited from
AdminForthResourceColumnInputCommon
. maxLength
maxValue?
optional
maxValue:number
Maximum value that can be entered in this field.
Inherited from
AdminForthResourceColumnInputCommon
. maxValue
min?
optional
min:number
Inherited from
AdminForthResourceColumnInputCommon
. min
minLength?
optional
minLength:number
Minimum length of string that can be entered in this field.
Inherited from
AdminForthResourceColumnInputCommon
. minLength
minValue?
optional
minValue:number
Minimum value that can be entered in this field.
Inherited from
AdminForthResourceColumnInputCommon
. minValue
name
name:
string
Column name in database.
Inherited from
AdminForthResourceColumnInputCommon
. name
primaryKey?
optional
primaryKey:boolean
Whether to use this column as record identifier. Only one column can be primary key. AdminForth tries to guess primary key automatically first.
Inherited from
AdminForthResourceColumnInputCommon
. primaryKey
required?
optional
required:boolean
|object
Whether AdminForth will require this field to be filled in create and edit forms. Can be set to boolean or object with create and edit properties. If boolean, it will be used for both create and edit forms.
Inherited from
AdminForthResourceColumnInputCommon
. required
showIn?
optional
showIn: ("show"
|"list"
|"edit"
|"create"
|"filter"
|AdminForthResourcePages
)[]
On which AdminForth pages this field will be shown. By default all. Example: if you want to show field only in create and edit pages, set it to
showIn: [AdminForthResourcePages.CREATE, AdminForthResourcePages.EDIT]
Inherited from
AdminForthResourceColumnInputCommon
. showIn
sortable?
optional
sortable:boolean
Inherited from
AdminForthResourceColumnInputCommon
. sortable
type?
optional
type:AdminForthDataTypes
Type of data in column. AdminForth will use this information to render proper input fields in the admin panel. AdminForth tries to guess type of data from database column type automatically for typed databases like SQL-based. However you can explicitly set it to any value. E.g. set AdminForthDataTypes.DATETIME for your string column in SQLite, which stores ISO date strings.
Inherited from
AdminForthResourceColumnInputCommon
. type
validation?
optional
validation:ValidationObject
[]
Runtime validation Regexp rules for this field.
Inherited from
AdminForthResourceColumnInputCommon
. validation
virtual?
optional
virtual:boolean
Allows to make the field which does not exist in database table. Examples: add custom show field with user country flag:
{
label: 'Country Flag',
type: AdminForthDataTypes.STRING,
virtual: true,
showIn: [AdminForthResourcePages.SHOW, AdminForthResourcePages.LIST],
components: {
show: '@@/CountryFlag.vue',
list: '@@/CountryFlag.vue',
},
}
This field will be displayed in show and list views with custom component CountryFlag.vue
. CountryFlag.vue should be placed in custom folder and can be next:
<template>
{{ getFlagEmojiFromIso(record.ipCountry) }}
</template>
<script setup>
const props = defineProps(['record']);
function getFlagEmojiFromIso(iso) {
return iso.toUpperCase().replace(/./g, (char) => String.fromCodePoint(char.charCodeAt(0) + 127397));
}
</script>