PHP Class Grido\Grid

Author: Petr Bugyík
Inheritance: extends Grido\Components\Container
Mostra file Open project: o5/grido Class Usage Examples

Public Properties

Property Type Description
$filter array @persistent
$onFetchData event for modifying data
$onRegistered event on all grid's components registered
$onRender event on render
$page integer @persistent
$perPage integer @persistent
$sort array @persistent

Protected Properties

Property Type Description
$count total count of items
$customization grido\Customization
$data mixed
$defaultFilter array
$defaultPerPage integer
$defaultSort array
$filterRenderType string
$model Grido\DataSources\IDataSource
$options array
$paginator Grido\Components\Paginator
$perPageList array
$primaryKey string
$propertyAccessor Symfony\Component\PropertyAccess\PropertyAccessor
$rememberState boolean
$rememberStateSectionName string
$rowCallback returns tr html element; function($row, Html $tr)
$strictMode boolean
$tablePrototype Nette\Utils\Html
$translator Nette\Localization\ITranslator

Public Methods

Method Description
__getConditions ( array $filter ) : array
__triggerUserNotice ( string $message )
createTemplate ( ) : Nette\Templating\FileTemplate
getActualFilter ( string $key = NULL ) : mixed Returns actual filter values.
getClientSideOptions ( ) : array Returns client-side options.
getCount ( ) : integer Returns total count of data.
getCustomization ( ) : grido\Customization
getData ( boolean $applyPaging = TRUE, boolean $useCache = TRUE, boolean $fetch = TRUE ) : array | Grido\DataSources\IDataSource | Selection Returns fetched data.
getDefaultFilter ( ) : array Returns default filter.
getDefaultPerPage ( ) : integer Returns default per page.
getDefaultSort ( ) : array Returns default sort.
getFilterRenderType ( ) : string
getModel ( ) : Grido\DataSources\IDataSource
getPaginator ( ) : Grido\Components\Paginator
getPerPage ( ) : integer Returns items per page.
getPerPageList ( ) : array Returns list of possible items per page.
getPrimaryKey ( ) : string Returns primary key.
getProperty ( array | object $object, string $name ) : mixed A simple wrapper around symfony/property-access with Nette Database dot notation support.
getPropertyAccessor ( ) : PropertyAccessor
getRememberSession ( boolean $forceStart = FALSE ) : SessionSection | null Returns remember session for set expiration, etc.
getRememberState ( ) : boolean Returns remember state.
getRowCallback ( ) : callback Returns row callback.
getRowPrototype ( mixed $row ) : Nette\Utils\Html
getTablePrototype ( ) : Nette\Utils\Html Returns table html element of grid.
getTranslator ( ) : Grido\Translations\FileTranslator Returns translator.
handleFilter ( Nette\Forms\Controls\SubmitButton $button )
handlePage ( integer $page )
handlePerPage ( Nette\Forms\Controls\SubmitButton $button )
handleRefresh ( ) Ajax method.
handleReset ( Nette\Forms\Controls\SubmitButton $button )
handleSort ( array $sort )
isStrictMode ( ) : boolean
loadState ( array $params ) Loads state informations.
reload ( ) : void Refresh wrapper.
render ( )
saveState ( array &$params, Nette\Application\UI\PresenterComponentReflection $reflection = NULL ) Saves state informations for next request.
setClientSideOptions ( array $options ) : Grid Sets client-side options.
setCustomization ( grido\Customization $customization )
setDefaultFilter ( array $filter ) : Grid Sets default filtering.
setDefaultPerPage ( integer $perPage ) : Grid Sets the default number of items per page.
setDefaultSort ( array $sort ) : Grid Sets default sorting.
setFilterRenderType ( string $type ) : Grid Sets type of filter rendering.
setModel ( mixed $model, boolean $forceWrapper = FALSE ) : Grid Sets a model that implements the interface Grido\DataSources\IDataSource or data-source object.
setPaginator ( Grido\Components\Paginator $paginator ) : Grid Sets custom paginator.
setPerPageList ( array $perPageList ) : Grid Sets items to per-page select.
setPrimaryKey ( string $key ) : Grid Sets grid primary key.
setRememberState ( boolean $state = TRUE, string $sectionName = NULL ) : Grid Sets saving state to session.
setRowCallback ( $callback ) : Grid Sets callback for customizing tr html object.
setStrictMode ( boolean $mode ) : Grid Determines whether any user error will cause a notice.
setTemplateFile ( string $file ) : Grid Sets file name of custom template.
setTranslator ( Nette\Localization\ITranslator $translator ) : Grid Sets translator.

Protected Methods

Method Description
applyFiltering ( )
applyPaging ( )
applySorting ( )
createComponentForm ( $name )
getItemsForCountSelect ( ) : array
saveRememberState ( )

Method Details

__getConditions() public method

public __getConditions ( array $filter ) : array
$filter array
return array

__triggerUserNotice() public method

public __triggerUserNotice ( string $message )
$message string

applyFiltering() protected method

protected applyFiltering ( )

applyPaging() protected method

protected applyPaging ( )

applySorting() protected method

protected applySorting ( )

createComponentForm() protected method

protected createComponentForm ( $name )

createTemplate() public method

public createTemplate ( ) : Nette\Templating\FileTemplate
return Nette\Templating\FileTemplate

getActualFilter() public method

Returns actual filter values.
public getActualFilter ( string $key = NULL ) : mixed
$key string
return mixed

getClientSideOptions() public method

Returns client-side options.
public getClientSideOptions ( ) : array
return array

getCount() public method

Returns total count of data.
public getCount ( ) : integer
return integer

getCustomization() public method

public getCustomization ( ) : grido\Customization
return grido\Customization

getData() public method

Returns fetched data.
public getData ( boolean $applyPaging = TRUE, boolean $useCache = TRUE, boolean $fetch = TRUE ) : array | Grido\DataSources\IDataSource | Selection
$applyPaging boolean
$useCache boolean
$fetch boolean
return array | Grido\DataSources\IDataSource | Nette\Database\Table\Selection

getDefaultFilter() public method

Returns default filter.
public getDefaultFilter ( ) : array
return array

getDefaultPerPage() public method

Returns default per page.
public getDefaultPerPage ( ) : integer
return integer

getDefaultSort() public method

Returns default sort.
public getDefaultSort ( ) : array
return array

getFilterRenderType() public method

public getFilterRenderType ( ) : string
return string

getItemsForCountSelect() protected method

protected getItemsForCountSelect ( ) : array
return array

getModel() public method

public getModel ( ) : Grido\DataSources\IDataSource
return Grido\DataSources\IDataSource

getPaginator() public method

public getPaginator ( ) : Grido\Components\Paginator
return Grido\Components\Paginator

getPerPage() public method

Returns items per page.
public getPerPage ( ) : integer
return integer

getPerPageList() public method

Returns list of possible items per page.
public getPerPageList ( ) : array
return array

getPrimaryKey() public method

Returns primary key.
public getPrimaryKey ( ) : string
return string

getProperty() public method

A simple wrapper around symfony/property-access with Nette Database dot notation support.
public getProperty ( array | object $object, string $name ) : mixed
$object array | object
$name string
return mixed

getPropertyAccessor() public method

public getPropertyAccessor ( ) : PropertyAccessor
return Symfony\Component\PropertyAccess\PropertyAccessor

getRememberSession() public method

Returns remember session for set expiration, etc.
public getRememberSession ( boolean $forceStart = FALSE ) : SessionSection | null
$forceStart boolean - if TRUE, session will be started if not
return Nette\Http\SessionSection | null

getRememberState() public method

Returns remember state.
public getRememberState ( ) : boolean
return boolean

getRowCallback() public method

Returns row callback.
public getRowCallback ( ) : callback
return callback

getRowPrototype() public method

public getRowPrototype ( mixed $row ) : Nette\Utils\Html
$row mixed item from db
return Nette\Utils\Html

getTablePrototype() public method

Returns table html element of grid.
public getTablePrototype ( ) : Nette\Utils\Html
return Nette\Utils\Html

getTranslator() public method

Returns translator.
public getTranslator ( ) : Grido\Translations\FileTranslator
return Grido\Translations\FileTranslator

handleFilter() public method

public handleFilter ( Nette\Forms\Controls\SubmitButton $button )
$button Nette\Forms\Controls\SubmitButton

handlePage() public method

public handlePage ( integer $page )
$page integer

handlePerPage() public method

public handlePerPage ( Nette\Forms\Controls\SubmitButton $button )
$button Nette\Forms\Controls\SubmitButton

handleRefresh() public method

Ajax method.
public handleRefresh ( )

handleReset() public method

public handleReset ( Nette\Forms\Controls\SubmitButton $button )
$button Nette\Forms\Controls\SubmitButton

handleSort() public method

public handleSort ( array $sort )
$sort array

isStrictMode() public method

public isStrictMode ( ) : boolean
return boolean

loadState() public method

Loads state informations.
public loadState ( array $params )
$params array

reload() public method

Refresh wrapper.
public reload ( ) : void
return void

render() public method

public render ( )

saveRememberState() protected method

protected saveRememberState ( )

saveState() public method

Saves state informations for next request.
public saveState ( array &$params, Nette\Application\UI\PresenterComponentReflection $reflection = NULL )
$params array
$reflection Nette\Application\UI\PresenterComponentReflection (internal, used by Presenter)

setClientSideOptions() public method

Sets client-side options.
public setClientSideOptions ( array $options ) : Grid
$options array
return Grid

setCustomization() public method

public setCustomization ( grido\Customization $customization )
$customization grido\Customization

setDefaultFilter() public method

Sets default filtering.
public setDefaultFilter ( array $filter ) : Grid
$filter array
return Grid

setDefaultPerPage() public method

Sets the default number of items per page.
public setDefaultPerPage ( integer $perPage ) : Grid
$perPage integer
return Grid

setDefaultSort() public method

Sets default sorting.
public setDefaultSort ( array $sort ) : Grid
$sort array
return Grid

setFilterRenderType() public method

Defaults inner (Filter::RENDER_INNER) if column does not exist then outer filter (Filter::RENDER_OUTER).
public setFilterRenderType ( string $type ) : Grid
$type string
return Grid

setModel() public method

Sets a model that implements the interface Grido\DataSources\IDataSource or data-source object.
public setModel ( mixed $model, boolean $forceWrapper = FALSE ) : Grid
$model mixed
$forceWrapper boolean
return Grid

setPaginator() public method

Sets custom paginator.
public setPaginator ( Grido\Components\Paginator $paginator ) : Grid
$paginator Grido\Components\Paginator
return Grid

setPerPageList() public method

Sets items to per-page select.
public setPerPageList ( array $perPageList ) : Grid
$perPageList array
return Grid

setPrimaryKey() public method

Defaults is "id".
public setPrimaryKey ( string $key ) : Grid
$key string
return Grid

setRememberState() public method

Sets saving state to session.
public setRememberState ( boolean $state = TRUE, string $sectionName = NULL ) : Grid
$state boolean
$sectionName string
return Grid

setRowCallback() public method

Callback returns tr html element; function($row, Html $tr).
public setRowCallback ( $callback ) : Grid
$callback
return Grid

setStrictMode() public method

Determines whether any user error will cause a notice.
public setStrictMode ( boolean $mode ) : Grid
$mode boolean
return Grid

setTemplateFile() public method

Sets file name of custom template.
public setTemplateFile ( string $file ) : Grid
$file string
return Grid

setTranslator() public method

Sets translator.
public setTranslator ( Nette\Localization\ITranslator $translator ) : Grid
$translator Nette\Localization\ITranslator
return Grid

Property Details

$count protected_oe property

total count of items
protected $count

$customization protected_oe property

protected Customization,grido $customization
return grido\Customization

$data protected_oe property

protected mixed $data
return mixed

$defaultFilter protected_oe property

protected array $defaultFilter
return array

$defaultPerPage protected_oe property

protected int $defaultPerPage
return integer

$defaultSort protected_oe property

protected array $defaultSort
return array

$filter public_oe property

@persistent
public array $filter
return array

$filterRenderType protected_oe property

protected string $filterRenderType
return string

$model protected_oe property

protected IDataSource,Grido\DataSources $model
return Grido\DataSources\IDataSource

$onFetchData public_oe property

event for modifying data
public $onFetchData

$onRegistered public_oe property

event on all grid's components registered
public $onRegistered

$onRender public_oe property

event on render
public $onRender

$options protected_oe property

protected array $options
return array

$page public_oe property

@persistent
public int $page
return integer

$paginator protected_oe property

protected Paginator,Grido\Components $paginator
return Grido\Components\Paginator

$perPage public_oe property

@persistent
public int $perPage
return integer

$perPageList protected_oe property

protected array $perPageList
return array

$primaryKey protected_oe property

protected string $primaryKey
return string

$propertyAccessor protected_oe property

protected PropertyAccessor,Symfony\Component\PropertyAccess $propertyAccessor
return Symfony\Component\PropertyAccess\PropertyAccessor

$rememberState protected_oe property

protected bool $rememberState
return boolean

$rememberStateSectionName protected_oe property

protected string $rememberStateSectionName
return string

$rowCallback protected_oe property

returns tr html element; function($row, Html $tr)
protected $rowCallback

$sort public_oe property

@persistent
public array $sort
return array

$strictMode protected_oe property

protected bool $strictMode
return boolean

$tablePrototype protected_oe property

protected Html,Nette\Utils $tablePrototype
return Nette\Utils\Html

$translator protected_oe property

protected ITranslator,Nette\Localization $translator
return Nette\Localization\ITranslator