PHP Class Ublaboo\DataGrid\Column\Column

Inheritance: extends Ublaboo\DataGrid\Object
Show file Open project: ublaboo/datagrid Class Usage Examples

Protected Properties

Property Type Description
$align string
$default_hide boolean
$editable_callback callable
$editable_element array
$el_cache array Cached html elements
$header_escaping boolean
$renderer Renderer | null
$replacements array
$sort array
$sortable boolean | string
$sortable_callback null | callable
$sortable_reset_pagination boolean
$template string
$template_escaping boolean
$template_variables array

Public Methods

Method Description
addAttributes ( array $attrs ) : static Set attributes for both th and td element
applyReplacements ( Row $row ) : array Apply replacements
getAlign ( ) : string Get column alignment
getColumn ( ) : string
getColumnName ( ) : string Get column name
getColumnValue ( Row $row ) : mixed Get column value of row item
getDefaultHide ( )
getEditableCallback ( ) : callable Return callback that is used after inline editing
getEditableInputType ( ) : array [getEditableInputType description]
getElementPrototype ( string $tag, string $key = NULL, Row $row = NULL ) : Nette\Utils\Html Get th/td column element
getName ( ) : string
getRenderer ( ) : Renderer | null Return custom renderer callback
getSortNext ( ) : array What sorting will be applied after next click?
getSortableCallback ( ) : callable | null Get custom ORDER BY clause
getSortingColumn ( ) : string Get column to sort by
getTemplate ( ) : string Get column template path
getTemplateVariables ( ) : array Column can have variables that will be passed to custom template scope
hasAlign ( ) : boolean Has column some alignment?
hasReplacements ( ) : boolean Tell whether columns has replacements
hasSortNext ( ) : boolean
hasTemplate ( ) : boolean Tell whether column has its owntemplate
isEditable ( ) : boolean Is column editable?
isHeaderEscaped ( )
isSortAsc ( ) : boolean Is sorting ascending?
isSortable ( ) : boolean Tell whether column is sortable
isSortedBy ( ) : boolean Tell whether data source is sorted by this collumn
isTemplateEscaped ( )
render ( Row $row ) : mixed Render row item into template
setAlign ( string $align ) Set column alignment
setDefaultHide ( boolean $default_hide = TRUE ) : static
setEditableCallback ( callable $editable_callback ) Set callback that will be called after inline editing
setEditableInputType ( string $el_type, array $attrs = [] ) : static Element is by default textarea, user can change that
setEditableInputTypeSelect ( array $options = [] ) : static Change small inline edit input type to select
setFitContent ( boolean $fit_content = TRUE ) Set column content fit
setHeaderEscaping ( boolean $header_escaping = FALSE ) Should be column header escaped in latte?
setRenderer ( callable $renderer, $condition_callback = NULL ) Set renderer callback and (it may be optional - the condition callback will decide)
setRendererOnCondition ( callable $renderer, $condition_callback ) Set renderer callback just if condition is truthy
setReplacement ( array $replacements ) : Column Set column replacements
setSort ( array $sort ) Tell column his sorting options
setSortable ( boolean | string $sortable = TRUE ) Set column sortable or not
setSortableCallback ( callable $sortable_callback ) : static Set custom ORDER BY clause
setSortableResetPagination ( boolean $sortable_reset_pagination = TRUE ) : static Shoud be the pagination reseted after sorting?
setTemplate ( string $template, array $template_variables = [] ) Column may have its own template
setTemplateEscaping ( boolean $template_escaping = TRUE ) Should be column values escaped in latte?
sortableResetPagination ( ) : boolean Do reset pagination after sorting?
useRenderer ( Row $row ) : mixed Try to render item with custom renderer

Protected Methods

Method Description
getItemParams ( Row $row, array $params_list ) : array Get row item params (E.g. action may be called id => $item->id, name => $item->name, .

Method Details

addAttributes() public method

Set attributes for both th and td element
public addAttributes ( array $attrs ) : static
$attrs array
return static

applyReplacements() public method

Apply replacements
public applyReplacements ( Row $row ) : array
$row Ublaboo\DataGrid\Row
return array

getAlign() public method

Get column alignment
public getAlign ( ) : string
return string

getColumn() public method

public getColumn ( ) : string
return string

getColumnName() public method

Get column name
public getColumnName ( ) : string
return string

getColumnValue() public method

Get column value of row item
public getColumnValue ( Row $row ) : mixed
$row Ublaboo\DataGrid\Row
return mixed

getDefaultHide() public method

public getDefaultHide ( )

getEditableCallback() public method

Return callback that is used after inline editing
public getEditableCallback ( ) : callable
return callable

getEditableInputType() public method

[getEditableInputType description]
public getEditableInputType ( ) : array
return array

getElementPrototype() public method

Get th/td column element
public getElementPrototype ( string $tag, string $key = NULL, Row $row = NULL ) : Nette\Utils\Html
$tag string th|td
$key string
$row Ublaboo\DataGrid\Row
return Nette\Utils\Html

getItemParams() protected method

..)
protected getItemParams ( Row $row, array $params_list ) : array
$row Ublaboo\DataGrid\Row
$params_list array
return array

getName() public method

public getName ( ) : string
return string

getRenderer() public method

Return custom renderer callback
public getRenderer ( ) : Renderer | null
return Renderer | null

getSortNext() public method

What sorting will be applied after next click?
public getSortNext ( ) : array
return array

getSortableCallback() public method

Get custom ORDER BY clause
public getSortableCallback ( ) : callable | null
return callable | null

getSortingColumn() public method

Get column to sort by
public getSortingColumn ( ) : string
return string

getTemplate() public method

Get column template path
public getTemplate ( ) : string
return string

getTemplateVariables() public method

Column can have variables that will be passed to custom template scope
public getTemplateVariables ( ) : array
return array

hasAlign() public method

Has column some alignment?
public hasAlign ( ) : boolean
return boolean [description]

hasReplacements() public method

Tell whether columns has replacements
public hasReplacements ( ) : boolean
return boolean

hasSortNext() public method

public hasSortNext ( ) : boolean
return boolean

hasTemplate() public method

Tell whether column has its owntemplate
public hasTemplate ( ) : boolean
return boolean

isEditable() public method

Is column editable?
public isEditable ( ) : boolean
return boolean

isHeaderEscaped() public method

public isHeaderEscaped ( )

isSortAsc() public method

Is sorting ascending?
public isSortAsc ( ) : boolean
return boolean

isSortable() public method

Tell whether column is sortable
public isSortable ( ) : boolean
return boolean

isSortedBy() public method

Tell whether data source is sorted by this collumn
public isSortedBy ( ) : boolean
return boolean

isTemplateEscaped() public method

public isTemplateEscaped ( )

render() public method

Render row item into template
public render ( Row $row ) : mixed
$row Ublaboo\DataGrid\Row
return mixed

setAlign() public method

Set column alignment
public setAlign ( string $align )
$align string

setDefaultHide() public method

public setDefaultHide ( boolean $default_hide = TRUE ) : static
$default_hide boolean
return static

setEditableCallback() public method

Set callback that will be called after inline editing
public setEditableCallback ( callable $editable_callback )
$editable_callback callable

setEditableInputType() public method

Element is by default textarea, user can change that
public setEditableInputType ( string $el_type, array $attrs = [] ) : static
$el_type string
$attrs array
return static

setEditableInputTypeSelect() public method

Change small inline edit input type to select
public setEditableInputTypeSelect ( array $options = [] ) : static
$options array
return static

setFitContent() public method

Set column content fit
public setFitContent ( boolean $fit_content = TRUE )
$fit_content boolean

setHeaderEscaping() public method

Should be column header escaped in latte?
public setHeaderEscaping ( boolean $header_escaping = FALSE )
$header_escaping boolean

setRenderer() public method

Set renderer callback and (it may be optional - the condition callback will decide)
public setRenderer ( callable $renderer, $condition_callback = NULL )
$renderer callable

setRendererOnCondition() public method

Set renderer callback just if condition is truthy
public setRendererOnCondition ( callable $renderer, $condition_callback )
$renderer callable

setReplacement() public method

Set column replacements
public setReplacement ( array $replacements ) : Column
$replacements array
return Column

setSort() public method

Tell column his sorting options
public setSort ( array $sort )
$sort array

setSortable() public method

Set column sortable or not
public setSortable ( boolean | string $sortable = TRUE )
$sortable boolean | string

setSortableCallback() public method

Set custom ORDER BY clause
public setSortableCallback ( callable $sortable_callback ) : static
$sortable_callback callable
return static

setSortableResetPagination() public method

Shoud be the pagination reseted after sorting?
public setSortableResetPagination ( boolean $sortable_reset_pagination = TRUE ) : static
$sortable_reset_pagination boolean
return static

setTemplate() public method

Column may have its own template
public setTemplate ( string $template, array $template_variables = [] )
$template string
$template_variables array

setTemplateEscaping() public method

Should be column values escaped in latte?
public setTemplateEscaping ( boolean $template_escaping = TRUE )
$template_escaping boolean

sortableResetPagination() public method

Do reset pagination after sorting?

useRenderer() public method

Try to render item with custom renderer
public useRenderer ( Row $row ) : mixed
$row Ublaboo\DataGrid\Row
return mixed

Property Details

$align protected property

protected string $align
return string

$default_hide protected property

protected bool $default_hide
return boolean

$editable_callback protected property

protected callable $editable_callback
return callable

$editable_element protected property

protected array $editable_element
return array

$el_cache protected property

Cached html elements
protected array $el_cache
return array

$header_escaping protected property

protected bool $header_escaping
return boolean

$renderer protected property

protected Renderer,Ublaboo\DataGrid\Column|NULL $renderer
return Renderer | null

$replacements protected property

protected array $replacements
return array

$sort protected property

protected array $sort
return array

$sortable protected property

protected bool|string $sortable
return boolean | string

$sortable_callback protected property

protected null|callable $sortable_callback
return null | callable

$sortable_reset_pagination protected property

protected bool $sortable_reset_pagination
return boolean

$template protected property

protected string $template
return string

$template_escaping protected property

protected bool $template_escaping
return boolean

$template_variables protected property

protected array $template_variables
return array