Backend\Classes\ListColumn

List Columns definition A translation of the list column configuration

Public properties

public string $columnName

columnName within the list

public string $label

label for list column

public string $type

type for display mode, eg: text, number

public bool $searchable

searchable specifies if this column can be searched

public bool $invisible

invisible specifies if this column is hidden by default

public bool $sortable

sortable specifies if this column can be sorted

public bool $clickable

clickable disables the default click behavior when the column is clicked

public string $valueFrom

valueFrom is a model attribute to use for the accessed value

public string $displayFrom

displayFrom is a model attribute to use for the displayed value

public string $defaults

defaults specifies a default value when value is empty

public string $sqlSelect

sqlSelect is a custom SQL for selecting this record display value, the @ symbol is replaced with the table name.

public string $relation

Relation name, if this column represents a model relationship.

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.

public string $cssClass

Specify a CSS class to attach to the list cell element.

public string $headCssClass

Specify a CSS class to attach to the list header cell element.

public string $format

Specify a format or style for the column value, such as a Date.

public string $path

Specifies a path for partial-type fields.

public string $align

Specifies the alignment of this column.

public array $config

Raw field configuration.

Public methods

public void __construct(string $columnName, string $label)

Constructor.

Parameters
  • string $columnName
  • string $label

public void displayAs(string $type, $config)

Specifies a list column rendering mode. Supported modes are:

  • text - text column, aligned left
  • number - numeric column, aligned right
Parameters
  • string $type - Specifies a render mode as described above
  • $config

public string getAlignClass()

Returns the column specific aligment css class.

public mixed getConfig(string $value, string $default=NULL)

getConfig returns a raw config item value

Parameters
  • string $value
  • string $default

public string getId(string $suffix=NULL)

Returns a value suitable for the column id property.

Parameters
  • string $suffix - Specify a suffix string

public string getName()

Returns a HTML valid name for the column name.

public mixed getValueFromData(mixed $data, mixed $default=NULL)

getValueFromData returns this columns value from a supplied data set, which can be an array or a model or another generic collection.

Parameters
  • mixed $data
  • mixed $default

Protected methods

protected array evalConfig(array $config)

Process options and apply them to this object.

Parameters
  • array $config

protected mixed getColumnNameFromData(string $columnName, mixed $data, mixed $default=NULL)

Internal method to extract the value of a column name from a data set.

Parameters
  • string $columnName
  • mixed $data
  • mixed $default