PHP Class Grid_Basic, atk4

Inheritance: extends CompleteLister
Datei anzeigen Open project: atk4/atk4 Class Usage Examples

Public Properties

Property Type Description
$app App_Web
$buttonset ButtonSet Grid buttons.
$columns Grid columns
$default_controller Default grid controller
$last_column Pointer to last added grid column
$show_header Should we show header line
$sort_icons jQuery-UI icons to show as sort icons in header

Protected Properties

Property Type Description
$no_records_message No records message. See setNoRecords()

Public Methods

Method Description
addButton ( string | array $label, string $class = 'Button' ) : Button Adds button.
addColumn ( mixed $formatters, string $name = null, string | array $descr = null ) Add column to grid.
addFormatter ( string $field, mixed $formatter, array $options = null ) Add extra formatter to existing field.
applyTDParams ( string $field, SQLite &$row_template = null ) Apply TD parameters in appropriate template.
defaultTemplate ( ) : array Default template.
executeFormatters ( string $field, array $column, string $formatter_prefix = 'format_', boolean $silent = false ) Format field value using appropriate formatters.
formatRow ( ) Format grid row.
format_text ( string $field ) Default formatter.
getColumn ( string $name ) Set column as "last column".
hasColumn ( string $name ) : boolean Check if we have such column.
importFields ( Model $model, array $fields = UNDEFINED ) Import fields using controller.
init ( ) Initialization.
initWidget ( ) You might want Grid to be enchanced with a widget. Initialize it here or define this as empty function to avoid.
precacheTemplate ( ) Precaches template chunks.
removeColumn ( string $name ) Remove column from grid.
renderRows ( ) Render grid rows.
setCaption ( string $name ) Set caption of column.
setFormatter ( string $field, mixed $formatter, $options = null ) Replace current formatter for field.
setNoRecordsMessage ( string $message ) Set message to show when no records are retrieved.

Method Details

addButton() public method

Adds button.
public addButton ( string | array $label, string $class = 'Button' ) : Button
$label string | array label of button
$class string optional name of button class
return Button

addColumn() public method

Add column to grid.
public addColumn ( mixed $formatters, string $name = null, string | array $descr = null )
$formatters mixed
$name string
$descr string | array

addFormatter() public method

Add extra formatter to existing field.
public addFormatter ( string $field, mixed $formatter, array $options = null )
$field string
$formatter mixed
$options array

applyTDParams() public method

You can pass row template too. That's useful to set up totals rows, for example.
public applyTDParams ( string $field, SQLite &$row_template = null )
$field string Fieldname
$row_template SQLite Optional row template

defaultTemplate() public method

Default template.
public defaultTemplate ( ) : array
return array

executeFormatters() public method

Format field value using appropriate formatters.
public executeFormatters ( string $field, array $column, string $formatter_prefix = 'format_', boolean $silent = false )
$field string field name
$column array column configuration
$formatter_prefix string prefix of formatter methods
$silent boolean don't throw exception if formatter not found

formatRow() public method

Extends formatRow method of CompleteLister
public formatRow ( )

format_text() public method

Default formatter.
public format_text ( string $field )
$field string

getColumn() public method

Set column as "last column".
public getColumn ( string $name )
$name string

hasColumn() public method

Check if we have such column.
public hasColumn ( string $name ) : boolean
$name string
return boolean

importFields() public method

Import fields using controller.
public importFields ( Model $model, array $fields = UNDEFINED )
$model Model
$fields array

init() public method

Initialization.
public init ( )

initWidget() public method

You might want Grid to be enchanced with a widget. Initialize it here or define this as empty function to avoid.
public initWidget ( )

precacheTemplate() public method

Precaches template chunks.
public precacheTemplate ( )

removeColumn() public method

Remove column from grid.
public removeColumn ( string $name )
$name string

renderRows() public method

Extends renderRows method of CompleteLister
public renderRows ( )

setCaption() public method

Set caption of column.
public setCaption ( string $name )
$name string

setFormatter() public method

Replace current formatter for field.
public setFormatter ( string $field, mixed $formatter, $options = null )
$field string
$formatter mixed

setNoRecordsMessage() public method

Set message to show when no records are retrieved.
public setNoRecordsMessage ( string $message )
$message string

Property Details

$app public_oe property

public App_Web $app
return App_Web

$buttonset public_oe property

Grid buttons.
See also: addButton()
public ButtonSet $buttonset
return ButtonSet

$columns public_oe property

Grid columns
public $columns

$default_controller public_oe property

Default grid controller
public $default_controller

$last_column public_oe property

Pointer to last added grid column
public $last_column

$no_records_message protected_oe property

No records message. See setNoRecords()
protected $no_records_message

$show_header public_oe property

Should we show header line
public $show_header

$sort_icons public_oe property

jQuery-UI icons to show as sort icons in header
public $sort_icons