Programmer error or hard

南宫才艺
2023-12-01
October cms backend
     Available column types
          可用列类型:

Text

text - displays a text column, aligned left

full_name:
    label: Full Name
    type: text

Number

number - displays a number column, aligned right

age:
    label: Age
    type: number

Switch

switch - displays a on or off state for boolean columns.

enabled:
    label: Enabled
    type: switch

Date & Time

datetime - displays the column value as a formatted date and time. The next example displays dates as Thu, Dec 25, 1975 2:15 PM.

created_at:
    label: Date
    type: datetime

You can also specify a custom date format, for example Thursday 25th of December 1975 02:15:16 PM:

created_at:
    label: Date
    type: datetime
    format: l jS \of F Y h:i:s A

Date

date - displays the column value as date format M j, Y

created_at:
    label: Date
    type: date

Time

time - displays the column value as time format g:i A

created_at:
    label: Date
    type: time

Time since

timesince - displays a human readable time difference from the value to the current time. Eg: 10 minutes ago

created_at:
    label: Date
    type: timesince

Time tense

timetense - displays 24-hour time and the day using the grammatical tense of the current date. Eg: Today at 12:49,Yesterday at 4:00 or 18 Sep 2015 at 14:33.

created_at:
    label: Date
    type: timetense

Select

select - allows to create a column using a custom select statement. Any valid SQL SELECT statement works here.

full_name:
    label
: Full Name
   
select: concat(first_name, ' ', last_name)
    

Relation

relation - allows to display related columns, you can provide a relationship option. The value of this option has to be the name of the Active Record relationship on your model. In the next example the name value will be translated to the name attribute found in the related model (eg: $model->name).

group:
    label: Group
    relation: groups
    select: name

If the relationship definition uses the count argument, you can display the number of related records using thevalueFrom and default options.

users_count:
    label
: Users
    relation
: users_count
    valueFrom
: count
    default: 0

Partial

partial - renders a partial, the path value can refer to a partial view file otherwise the column name is used as the partial name. Inside the partial these variables are available: $value is the default cell value, $record is the model used for the cell and $column is the configured class object Backend\Classes\ListColumn.

content:
    type
: partial
    path
: ~/plugins/acme/blog/models/comments/_content_column.htm
 类似资料:

相关阅读

相关文章

相关问答