Class \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 \Prado\Web\UI\WebControls\setAllowPaging 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 \Prado\Web\UI\WebControls\setPageSize property, and to specify which page of data to be displayed, set \Prado\Web\UI\WebControls\setCurrentPageIndex.
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 \Prado\Web\UI\WebControls\setVirtualItemCount, and the data source only needs to contain the current page of data. To enable custom paging, set \Prado\Web\UI\WebControls\setAllowCustomPaging to true.
Class hierarchy
- \Prado\Web\UI\WebControls\TDataBoundControl
- \Prado\Web\UI\WebControls\TWebControl implements IStyleable
- \Prado\Web\UI\TControl implements IRenderable, IBindable
- \Prado\TApplicationComponent
- \Prado\TComponent
Since: 3.0
public
|
dataBind() : mixed
Performs databinding.
This method overrides the parent implementation by calling performSelect which fetches data from data source and does the actual binding work. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
onDataBound(mixed $param) : mixed
Raises <b>OnDataBound</b> event.
This method should be invoked after a databind is performed. It is mainly used by framework and component developers. |
public
|
onDataSourceChanged() : mixed
Sets {@see setRequiresDataBinding RequiresDataBinding} as true if the control is initialized.
This method is invoked when either setDataSource or setDataSourceID is changed. |
public
|
onInit(TEventParameter $param) : mixed
Sets page's <b>OnPreLoad</b> event handler as {@see pagePreLoad}.
If viewstate is disabled and the current request is a postback, \Prado\Web\UI\WebControls\setRequiresDataBinding will be set true. This method overrides the parent implementation. |
public
|
onPreRender(TEventParameter $param) : mixed
Ensures any pending databind is performed.
This method overrides the parent implementation. |
public
|
pagePreLoad(mixed $sender, TEventParameter $param) : mixed
Sets {@see getInitialized} as true.
This method is invoked when page raises PreLoad event. |
public
|
setAllowCustomPaging(bool $value) : mixed
Sets a value indicating whether the custom paging should be enabled.
When the pager is in custom paging mode, the \Prado\Web\UI\WebControls\setVirtualItemCount property is used to determine the paging, and the data items in the \Prado\Web\UI\WebControls\setDataSource are considered to be in the current page. |
public
|
|
public
|
|
public
|
|
public
|
setDataSource(array<string|int, mixed>|string|Traversable $value) : mixed
Sets the data source object associated with the databound control.
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
|
|
public
|
|
public
|
|
protected
|
|
protected
|
|
protected
|
ensureDataBound() : mixed
Ensures any pending {@see dataBind} is called.
This method calls dataBind if the data source is specified by setDataSourceID or if \Prado\Web\UI\WebControls\getRequiresDataBinding is true. |
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
abstract
|
|
protected
|
setInitialized(bool $value) : mixed
Sets a value indicating whether the databound control is initialized.
If initialized, any modification to \Prado\Web\UI\WebControls\setDataSource or \Prado\Web\UI\WebControls\setDataSourceID will set \Prado\Web\UI\WebControls\setRequiresDataBinding as true. |
protected
|
|
protected
|
setRequiresDataBinding(bool $value) : mixed
Sets a value indicating whether a databind call is required by the data bound control.
If true and the control has been prerendered while it uses the data source specified by setDataSourceID, a databind call will be called by this method. |
protected
|
validateDataSource(array<string|int, mixed>|string|Traversable $value) : Traversable
Validates if the parameter is a valid data source.
If it is a string or an array, it will be converted as a TList object. |