PRADO Component Framework for PHP 5
  • Home
  • About
  • Testimonials
  • Demos
  • Download
  • Documentation
  • Forum
  • Development
  • Tutorials
  • Class Docs
  • API Manual
  • Wiki

Packages

  • None
  • System
    • Caching
    • Collections
    • Data
      • ActiveRecord
        • Relations
        • Scaffold
          • InputBuilder
      • Commom
        • Sqlite
      • Common
        • Mssql
        • Mysql
        • Oracle
        • Pgsql
        • Sqlite
      • DataGateway
      • SqlMap
        • Configuration
        • Statements
    • Exceptions
    • I18N
    • IO
    • Security
    • Util
    • Web
      • Javascripts
      • Services
      • UI
        • ActiveControls
        • WebControls
    • Xml
  • Wsat
    • pages
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class TDataBoundControl

TDataBoundControl class.

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 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 setPageSize PageSize property, and to specify which page of data to be displayed, set 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 setVirtualItemCount VirtualItemCount, and the data source only needs to contain the current page of data. To enable custom paging, set setAllowCustomPaging AllowCustomPaging to true.

TComponent
Extended by TApplicationComponent
Extended by TControl implements IRenderable, IBindable
Extended by TWebControl implements IStyleable
Extended by TDataBoundControl

Direct known subclasses

TBaseDataList, TListControl, TRepeater

Indirect known subclasses

TActiveCheckBoxList, TActiveDataGrid, TDataGrid, TDataList, TDropDownList, TListBox, TRadioButtonList, TRatingList, TActiveDataList, TActiveDropDownList, TActiveListBox, TActiveRadioButtonList, TActiveRatingList, TActiveRepeater, TBulletedList, TCheckBoxList
Abstract
Package: System\Web\UI\WebControls
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 3.0
Located at Web/UI/WebControls/TDataBoundControl.php
Methods summary
public Traversable
# getDataSource( )

Returns

Traversable
data source object, defaults to null.
public
# setDataSource( Traversable|array|string $value )

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.

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.

Parameters

$value
Traversable|array|string
data source object
public string
# getDataSourceID( )

Returns

string
ID path to the data source control. Defaults to empty.
public
# setDataSourceID( string $value )

Parameters

$value
string
ID path to the data source control. The data source control must be locatable via TControl::findControl() call.
protected boolean
# getUsingDataSourceID( )

Returns

boolean
if the databound control uses the data source specified by TDataBoundControl::setDataSourceID(), or it uses the data source object specified by TDataBoundControl::setDataSource().
public
# onDataSourceChanged( )

Sets setRequiresDataBinding RequiresDataBinding as true if the control is initialized. This method is invoked when either TDataBoundControl::setDataSource() or TDataBoundControl::setDataSourceID() is changed.

Sets setRequiresDataBinding RequiresDataBinding as true if the control is initialized. This method is invoked when either TDataBoundControl::setDataSource() or TDataBoundControl::setDataSourceID() is changed.

protected boolean
# getInitialized( )

Returns

boolean
whether the databound control has been initialized. By default, the control is initialized after its viewstate has been restored.
protected
# setInitialized( boolean $value )

Sets a value indicating whether the databound control is initialized. If initialized, any modification to setDataSource DataSource or setDataSourceID DataSourceID will set setRequiresDataBinding RequiresDataBinding as true.

Sets a value indicating whether the databound control is initialized. If initialized, any modification to setDataSource DataSource or setDataSourceID DataSourceID will set setRequiresDataBinding RequiresDataBinding as true.

Parameters

$value
boolean
a value indicating whether the databound control is initialized.
protected boolean
# getIsDataBound( )

Returns

boolean
whether databind has been invoked in the previous page request
protected
# setIsDataBound( boolean $value )

Parameters

$value
boolean
if databind has been invoked in this page request
protected boolean
# getRequiresDataBinding( )

Returns

boolean
whether a databind call is required (by the data bound control)
public boolean
# getAllowPaging( )

Returns

boolean
whether paging is enabled. Defaults to false.
public
# setAllowPaging( boolean $value )

Parameters

$value
boolean
whether paging is enabled
public boolean
# getAllowCustomPaging( )

Returns

boolean
whether the custom paging is enabled. Defaults to false.
public
# setAllowCustomPaging( boolean $value )

Sets a value indicating whether the custom paging should be enabled. When the pager is in custom paging mode, the setVirtualItemCount VirtualItemCount property is used to determine the paging, and the data items in the setDataSource DataSource are considered to be in the current page.

Sets a value indicating whether the custom paging should be enabled. When the pager is in custom paging mode, the setVirtualItemCount VirtualItemCount property is used to determine the paging, and the data items in the setDataSource DataSource are considered to be in the current page.

Parameters

$value
boolean
whether the custom paging is enabled
public integer
# getCurrentPageIndex( )

Returns

integer
the zero-based index of the current page. Defaults to 0.
public
# setCurrentPageIndex( integer $value )

Parameters

$value
integer
the zero-based index of the current page

Throws

TInvalidDataValueException
if the value is less than 0
public integer
# getPageSize( )

Returns

integer
the number of data items on each page. Defaults to 10.
public
# setPageSize( integer $value )

Parameters

$value
integer
the number of data items on each page.

Throws

TInvalidDataValueException
if the value is less than 1
public integer
# getPageCount( )

Returns

integer
number of pages of data items available
public integer
# getVirtualItemCount( )

Returns

integer
virtual number of data items in the data source. Defaults to 0.

See

TDataBoundControl::setAllowCustomPaging()
public
# setVirtualItemCount( integer $value )

Parameters

$value
integer
virtual number of data items in the data source.

Throws

TInvalidDataValueException
if the value is less than 0

See

TDataBoundControl::setAllowCustomPaging()
protected
# setRequiresDataBinding( boolean $value )

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 TDataBoundControl::setDataSourceID(), a databind call will be called by this method.

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 TDataBoundControl::setDataSourceID(), a databind call will be called by this method.

Parameters

$value
boolean
whether a databind call is required.
protected
# ensureDataBound( )

Ensures any pending TDataBoundControl::dataBind() is called. This method calls TDataBoundControl::dataBind() if the data source is specified by TDataBoundControl::setDataSourceID() or if getRequiresDataBinding RequiresDataBinding is true.

Ensures any pending TDataBoundControl::dataBind() is called. This method calls TDataBoundControl::dataBind() if the data source is specified by TDataBoundControl::setDataSourceID() or if getRequiresDataBinding RequiresDataBinding is true.

protected TPagedDataSource
# createPagedDataSource( )

Returns

TPagedDataSource
creates a paged data source
public
# dataBind( )

Performs databinding. This method overrides the parent implementation by calling performSelect which fetches data from data source and does the actual binding work.

Performs databinding. This method overrides the parent implementation by calling performSelect which fetches data from data source and does the actual binding work.

Overrides

TControl::dataBind()
public
# dataSourceViewChanged( mixed $sender, mixed $param )
protected
# getDataSourceView( )
protected
# determineDataSource( )
abstract protected
# performDataBinding( mixed $data )
public
# onDataBound( mixed $param )

Raises OnDataBound event. This method should be invoked after a databind is performed. It is mainly used by framework and component developers.

Raises OnDataBound event. This method should be invoked after a databind is performed. It is mainly used by framework and component developers.

public
# onInit( TEventParameter $param )

Sets page's OnPreLoad event handler as TDataBoundControl::pagePreLoad(). If viewstate is disabled and the current request is a postback, setRequiresDataBinding RequiresDataBinding will be set true. This method overrides the parent implementation.

Sets page's OnPreLoad event handler as TDataBoundControl::pagePreLoad(). If viewstate is disabled and the current request is a postback, setRequiresDataBinding RequiresDataBinding will be set true. This method overrides the parent implementation.

Parameters

$param
TEventParameter
event parameter

Overrides

TControl::onInit()
public
# pagePreLoad( mixed $sender, TEventParameter $param )

Sets TDataBoundControl::getInitialized() as true. This method is invoked when page raises PreLoad event.

Sets TDataBoundControl::getInitialized() as true. This method is invoked when page raises PreLoad event.

Parameters

$sender
mixed
event sender
$param
TEventParameter
event parameter
public
# onPreRender( TEventParameter $param )

Ensures any pending databind is performed. This method overrides the parent implementation.

Ensures any pending databind is performed. This method overrides the parent implementation.

Parameters

$param
TEventParameter
event parameter

Overrides

TWebControl::onPreRender()
protected Traversable
# validateDataSource( Traversable|array|string $value )

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.

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.

Parameters

$value
Traversable|array|string
data source to be validated

Returns

Traversable
the data that is traversable

Throws

TInvalidDataTypeException
if the data is neither null nor Traversable
public
# getDataMember( )
public
# setDataMember( mixed $value )
public
# getSelectParameters( )
Methods inherited from TWebControl
addAttributesToRender(), clearStyle(), copyBaseAttributes(), createStyle(), getAccessKey(), getBackColor(), getBorderColor(), getBorderStyle(), getBorderWidth(), getCssClass(), getDecorator(), getDisplay(), getEnsureId(), getFont(), getForeColor(), getHasStyle(), getHeight(), getStyle(), getTabIndex(), getTagName(), getToolTip(), getWidth(), render(), renderBeginTag(), renderContents(), renderEndTag(), setAccessKey(), setBackColor(), setBorderColor(), setBorderStyle(), setBorderWidth(), setCssClass(), setDisplay(), setEnsureId(), setForeColor(), setHeight(), setStyle(), setTabIndex(), setToolTip(), setWidth()
Methods inherited from TControl
__construct(), __get(), addParsedObject(), addToPostDataLoader(), addedControl(), applyStyleSheetSkin(), autoBindProperty(), autoDataBindProperties(), bindProperty(), broadcastEvent(), bubbleEvent(), clearChildState(), clearControlState(), clearNamingContainer(), clearViewState(), convertUniqueIdToClientId(), createChildControls(), createControlCollection(), dataBindChildren(), dataBindProperties(), ensureChildControls(), findControl(), findControlsByID(), findControlsByType(), focus(), getAdapter(), getAllowChildControls(), getAttribute(), getAttributes(), getChildControlsCreated(), getClientID(), getControlStage(), getControlState(), getControls(), getCustomData(), getEnableTheming(), getEnableViewState(), getEnabled(), getHasAdapter(), getHasAttributes(), getHasChildInitialized(), getHasControls(), getHasInitialized(), getHasLoaded(), getHasLoadedPostData(), getHasPreRendered(), getID(), getIsSkinApplied(), getNamingContainer(), getPage(), getParent(), getRegisteredObject(), getSkinID(), getSourceTemplateControl(), getTemplateControl(), getUniqueID(), getViewState(), getVisible(), hasAttribute(), initRecursive(), isDescendentOf(), isObjectRegistered(), loadRecursive(), loadState(), loadStateRecursive(), onDataBinding(), onLoad(), onUnload(), preRenderRecursive(), raiseBubbleEvent(), registerObject(), removeAttribute(), removedControl(), renderChildren(), renderControl(), saveState(), saveStateRecursive(), setAdapter(), setAttribute(), setChildControlsCreated(), setControlStage(), setControlState(), setCustomData(), setEnableTheming(), setEnableViewState(), setEnabled(), setID(), setPage(), setSkinID(), setTemplateControl(), setViewState(), setVisible(), trackViewState(), traverseChildControls(), unbindProperty(), unloadRecursive(), unregisterObject()
Methods inherited from TApplicationComponent
getApplication(), getRequest(), getResponse(), getService(), getSession(), getUser(), publishAsset(), publishFilePath()
Methods inherited from TComponent
__call(), __destruct(), __isset(), __set(), __sleep(), __unset(), __wakeup(), asa(), attachBehavior(), attachBehaviors(), attachClassBehavior(), attachEventHandler(), canGetProperty(), canSetProperty(), clearBehaviors(), createdOnTemplate(), detachBehavior(), detachBehaviors(), detachClassBehavior(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), evaluateStatements(), fxAttachClassBehavior(), fxDetachClassBehavior(), getAutoGlobalListen(), getBehaviorsEnabled(), getClassHierarchy(), getEventHandlers(), getListeningToGlobalEvents(), getSubProperty(), hasEvent(), hasEventHandler(), hasProperty(), isa(), listen(), raiseEvent(), setSubProperty(), unlisten()
Constants inherited from TControl
AUTOMATIC_ID_PREFIX, CLIENT_ID_SEPARATOR, CS_CHILD_INITIALIZED, CS_CONSTRUCTED, CS_INITIALIZED, CS_LOADED, CS_PRERENDERED, CS_STATE_LOADED, ID_FORMAT, ID_SEPARATOR, IS_CHILD_CREATED, IS_CREATING_CHILD, IS_DISABLE_THEMING, IS_DISABLE_VIEWSTATE, IS_ID_SET, IS_SKIN_APPLIED, IS_STYLESHEET_APPLIED, RF_ADAPTER, RF_AUTO_BINDINGS, RF_CHILD_STATE, RF_CONTROLS, RF_CONTROLSTATE, RF_DATA_BINDINGS, RF_EVENTS, RF_NAMED_CONTROLS, RF_NAMED_CONTROLS_ID, RF_NAMED_OBJECTS, RF_SKIN_ID
Constants inherited from TComponent
GLOBAL_RAISE_EVENT_LISTENER
Properties inherited from TWebControl
$_decorator
Terms of Service | Contact Us
PRADO v3.2.4 API Manual API documentation generated by ApiGen 2.8.0
Copyright © 2006-2014 by the PRADO Group.
Powered by PRADO