ListColumn
in package
List Columns definition A translation of the list column configuration
Tags
Table of Contents
- $align : string
- $clickable : bool
- $columnName : string
- $config : array<string|int, mixed>
- $cssClass : string
- $defaults : string
- $format : string
- $headCssClass : string
- $invisible : bool
- $label : string
- $path : string
- $relation : string
- $searchable : bool
- $sortable : bool
- $sqlSelect : string
- $type : string
- $valueFrom : string
- $width : string
- __construct() : mixed
- Constructor.
- displayAs() : mixed
- Specifies a list column rendering mode. Supported modes are: - text - text column, aligned left - number - numeric column, aligned right
- getAlignClass() : string
- Returns the column specific aligment css class.
- getConfig() : mixed
- Returns a raw config item value.
- getId() : string
- Returns a value suitable for the column id property.
- getName() : string
- Returns a HTML valid name for the column name.
- getValueFromData() : mixed
- Returns this columns value from a supplied data set, which can be an array or a model or another generic collection.
- evalConfig() : array<string|int, mixed>
- Process options and apply them to this object.
- getColumnNameFromData() : mixed
- Internal method to extract the value of a column name from a data set.
Properties
$align
public
string
$align
Specifies the alignment of this column.
$clickable
public
bool
$clickable
= true
If set to false, disables the default click behavior when the column is clicked.
$columnName
public
string
$columnName
List column name.
$config
public
array<string|int, mixed>
$config
Raw field configuration.
$cssClass
public
string
$cssClass
Specify a CSS class to attach to the list cell element.
$defaults
public
string
$defaults
Specifies a default value when value is empty.
$format
public
string
$format
Specify a format or style for the column value, such as a Date.
$headCssClass
public
string
$headCssClass
Specify a CSS class to attach to the list header cell element.
$invisible
public
bool
$invisible
= false
Specifies if this column is hidden by default.
$label
public
string
$label
List column label.
$path
public
string
$path
Specifies a path for partial-type fields.
$relation
public
string
$relation
Relation name, if this column represents a model relationship.
$searchable
public
bool
$searchable
= false
Specifies if this column can be searched.
$sortable
public
bool
$sortable
= true
Specifies if this column can be sorted.
$sqlSelect
public
string
$sqlSelect
Custom SQL for selecting this record display value,
the @ symbol is replaced with the table name.
$type
public
string
$type
= 'text'
Display mode. Text, number
$valueFrom
public
string
$valueFrom
Model attribute to use for the display value, this will
override any $sqlSelect definition.
$width
public
string
$width
sets the column width, can be specified in percents (10%) or pixels (50px). There could be a single column without width specified, it will be stretched to take the available space.
Methods
__construct()
Constructor.
public
__construct(string $columnName, string $label) : mixed
Parameters
- $columnName : string
- $label : string
Return values
mixed —displayAs()
Specifies a list column rendering mode. Supported modes are: - text - text column, aligned left - number - numeric column, aligned right
public
displayAs(string $type, mixed $config) : mixed
Parameters
- $type : string
-
Specifies a render mode as described above
- $config : mixed
Return values
mixed —getAlignClass()
Returns the column specific aligment css class.
public
getAlignClass() : string
Return values
string —getConfig()
Returns a raw config item value.
public
getConfig(string $value[, string $default = null ]) : mixed
Parameters
- $value : string
- $default : string = null
Return values
mixed —getId()
Returns a value suitable for the column id property.
public
getId([string $suffix = null ]) : string
Parameters
- $suffix : string = null
-
Specify a suffix string
Return values
string —getName()
Returns a HTML valid name for the column name.
public
getName() : string
Return values
string —getValueFromData()
Returns this columns value from a supplied data set, which can be an array or a model or another generic collection.
public
getValueFromData(mixed $data[, mixed $default = null ]) : mixed
Parameters
- $data : mixed
- $default : mixed = null
Return values
mixed —evalConfig()
Process options and apply them to this object.
protected
evalConfig(array<string|int, mixed> $config) : array<string|int, mixed>
Parameters
- $config : array<string|int, mixed>
Return values
array<string|int, mixed> —getColumnNameFromData()
Internal method to extract the value of a column name from a data set.
protected
getColumnNameFromData(string $columnName, mixed $data[, mixed $default = null ]) : mixed
Parameters
- $columnName : string
- $data : mixed
- $default : mixed = null