PHP Класс Prado\Web\UI\WebControls\TDataBoundControl

TDataBoundControl is the based class for controls that need to populate data from data sources. It provides basic properties and methods that allow the derived controls to associate with data sources and retrieve data from them. TBC.... TDataBoundControl is equipped with paging capabilities. By setting {@link setAllowPaging AllowPaging} to true, the input data will be paged and only one page of data is actually populated into the data-bound control. This saves a lot of memory when dealing with larget datasets. To specify the number of data items displayed on each page, set the {@link setPageSize PageSize} property, and to specify which page of data to be displayed, set {@link setCurrentPageIndex CurrentPageIndex}. When the size of the original data is too big to be loaded all in the memory, one can enable custom paging. In custom paging, the total number of data items is specified manually via {@link setVirtualItemCount VirtualItemCount}, and the data source only needs to contain the current page of data. To enable custom paging, set {@link setAllowCustomPaging AllowCustomPaging} to true.
С версии: 3.0
Автор: Qiang Xue ([email protected])
Наследование: extends TWebControl
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
dataBind ( ) Performs databinding.
dataSourceViewChanged ( $sender, $param )
getAllowCustomPaging ( ) : boolean
getAllowPaging ( ) : boolean
getCurrentPageIndex ( ) : integer
getDataMember ( )
getDataSource ( ) : Traversable
getDataSourceID ( ) : string
getPageCount ( ) : integer
getPageSize ( ) : integer
getSelectParameters ( )
getVirtualItemCount ( ) : integer
onDataBound ( $param ) Raises OnDataBound event.
onDataSourceChanged ( ) Sets {@link setRequiresDataBinding RequiresDataBinding} as true if the control is initialized.
onInit ( $param ) Sets page's OnPreLoad event handler as {@link pagePreLoad}.
onPreRender ( $param ) Ensures any pending databind is performed.
pagePreLoad ( $sender, $param ) Sets {@link getInitialized} as true.
setAllowCustomPaging ( $value ) Sets a value indicating whether the custom paging should be enabled.
setAllowPaging ( $value )
setCurrentPageIndex ( $value )
setDataMember ( $value )
setDataSource ( $value ) Sets the data source object associated with the databound control.
setDataSourceID ( $value )
setPageSize ( $value )
setVirtualItemCount ( $value )

Защищенные методы

Метод Описание
createPagedDataSource ( ) : TPagedDataSource
determineDataSource ( )
ensureDataBound ( ) Ensures any pending {@link dataBind} is called.
getDataSourceView ( )
getInitialized ( ) : boolean
getIsDataBound ( ) : boolean
getRequiresDataBinding ( ) : boolean
getUsingDataSourceID ( ) : boolean
performDataBinding ( $data )
setInitialized ( $value ) Sets a value indicating whether the databound control is initialized.
setIsDataBound ( $value )
setRequiresDataBinding ( $value ) Sets a value indicating whether a databind call is required by the data bound control.
validateDataSource ( $value ) : Traversable Validates if the parameter is a valid data source.

Описание методов

createPagedDataSource() защищенный метод

protected createPagedDataSource ( ) : TPagedDataSource
Результат Prado\Collections\TPagedDataSource creates a paged data source

dataBind() публичный метод

This method overrides the parent implementation by calling {@link performSelect} which fetches data from data source and does the actual binding work.
public dataBind ( )

dataSourceViewChanged() публичный метод

public dataSourceViewChanged ( $sender, $param )

determineDataSource() защищенный метод

protected determineDataSource ( )

ensureDataBound() защищенный метод

This method calls {@link dataBind} if the data source is specified by {@link setDataSourceID} or if {@link getRequiresDataBinding RequiresDataBinding} is true.
protected ensureDataBound ( )

getAllowCustomPaging() публичный метод

public getAllowCustomPaging ( ) : boolean
Результат boolean whether the custom paging is enabled. Defaults to false.

getAllowPaging() публичный метод

public getAllowPaging ( ) : boolean
Результат boolean whether paging is enabled. Defaults to false.

getCurrentPageIndex() публичный метод

public getCurrentPageIndex ( ) : integer
Результат integer the zero-based index of the current page. Defaults to 0.

getDataMember() публичный метод

public getDataMember ( )

getDataSource() публичный метод

public getDataSource ( ) : Traversable
Результат Traversable data source object, defaults to null.

getDataSourceID() публичный метод

public getDataSourceID ( ) : string
Результат string ID path to the data source control. Defaults to empty.

getDataSourceView() защищенный метод

protected getDataSourceView ( )

getInitialized() защищенный метод

protected getInitialized ( ) : boolean
Результат boolean whether the databound control has been initialized. By default, the control is initialized after its viewstate has been restored.

getIsDataBound() защищенный метод

protected getIsDataBound ( ) : boolean
Результат boolean whether databind has been invoked in the previous page request

getPageCount() публичный метод

public getPageCount ( ) : integer
Результат integer number of pages of data items available

getPageSize() публичный метод

public getPageSize ( ) : integer
Результат integer the number of data items on each page. Defaults to 10.

getRequiresDataBinding() защищенный метод

protected getRequiresDataBinding ( ) : boolean
Результат boolean whether a databind call is required (by the data bound control)

getSelectParameters() публичный метод

public getSelectParameters ( )

getUsingDataSourceID() защищенный метод

protected getUsingDataSourceID ( ) : boolean
Результат boolean if the databound control uses the data source specified by {@link setDataSourceID}, or it uses the data source object specified by {@link setDataSource}.

getVirtualItemCount() публичный метод

См. также: setAllowCustomPaging
public getVirtualItemCount ( ) : integer
Результат integer virtual number of data items in the data source. Defaults to 0.

onDataBound() публичный метод

This method should be invoked after a databind is performed. It is mainly used by framework and component developers.
public onDataBound ( $param )

onDataSourceChanged() публичный метод

This method is invoked when either {@link setDataSource} or {@link setDataSourceID} is changed.
public onDataSourceChanged ( )

onInit() публичный метод

If viewstate is disabled and the current request is a postback, {@link setRequiresDataBinding RequiresDataBinding} will be set true. This method overrides the parent implementation.
public onInit ( $param )

onPreRender() публичный метод

This method overrides the parent implementation.
public onPreRender ( $param )

pagePreLoad() публичный метод

This method is invoked when page raises PreLoad event.
public pagePreLoad ( $sender, $param )

performDataBinding() абстрактный защищенный метод

abstract protected performDataBinding ( $data )

setAllowCustomPaging() публичный метод

When the pager is in custom paging mode, the {@link setVirtualItemCount VirtualItemCount} property is used to determine the paging, and the data items in the {@link setDataSource DataSource} are considered to be in the current page.
public setAllowCustomPaging ( $value )

setAllowPaging() публичный метод

public setAllowPaging ( $value )

setCurrentPageIndex() публичный метод

public setCurrentPageIndex ( $value )

setDataMember() публичный метод

public setDataMember ( $value )

setDataSource() публичный метод

The data source must implement Traversable interface. If an array is given, it will be converted to xxx. If a string is given, it will be converted to xxx.
public setDataSource ( $value )

setDataSourceID() публичный метод

public setDataSourceID ( $value )

setInitialized() защищенный метод

If initialized, any modification to {@link setDataSource DataSource} or {@link setDataSourceID DataSourceID} will set {@link setRequiresDataBinding RequiresDataBinding} as true.
protected setInitialized ( $value )

setIsDataBound() защищенный метод

protected setIsDataBound ( $value )

setPageSize() публичный метод

public setPageSize ( $value )

setRequiresDataBinding() защищенный метод

If true and the control has been prerendered while it uses the data source specified by {@link setDataSourceID}, a databind call will be called by this method.
protected setRequiresDataBinding ( $value )

setVirtualItemCount() публичный метод

См. также: setAllowCustomPaging
public setVirtualItemCount ( $value )

validateDataSource() защищенный метод

If it is a string or an array, it will be converted as a TList object.
protected validateDataSource ( $value ) : Traversable
Результат Traversable the data that is traversable