text
- displays a text column, aligned left
full_name:
label: Full Name
type: text
number
- displays a number column, aligned right
age:
label: Age
type: number
switch
- displays a on or off state for boolean columns.
enabled:
label: Enabled
type: switch
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
- displays the column value as date format M j, Y
created_at:
label: Date
type: date
time
- displays the column value as time format g:i A
created_at:
label: Date
type: time
timesince
- displays a human readable time difference from the value to the current time. Eg: 10 minutes ago
created_at:
label: Date
type: timesince
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
- 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
- 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
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