|
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
-
TApplicationComponent
-
TControl
implements
IRenderable,
IBindable
-
TWebControl
implements
IStyleable
-
TDataBoundControl
Indirect known subclasses
TActiveCheckBoxList,
TActiveDataGrid,
TDataGrid,
TDataList,
TDropDownList,
TListBox,
TRadioButtonList,
TRatingList,
TActiveDataList,
TActiveDropDownList,
TActiveListBox,
TActiveRadioButtonList,
TActiveRatingList,
TActiveRepeater,
TBulletedList,
TCheckBoxList
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( )
|
public
|
|
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
|
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
|
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
|
public
|
#
setVirtualItemCount( integer $value )
Parameters
- $value
integer virtual number of data items in the data source.
Throws
See
|
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
|
|
protected
TPagedDataSource
|
#
createPagedDataSource( )
|
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
|
public
|
#
dataSourceViewChanged( mixed $sender, mixed $param )
|
protected
|
|
protected
|
|
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
Overrides
|
public
|
|
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
Overrides
|
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
|
public
|
|
public
|
#
setDataMember( mixed $value )
|
public
|
|
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 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
|
|