Class TRepeater

Description

Implements interfaces:

TRepeater class

TRepeater displays its content defined in templates repeatedly based on the given data specified by the DataSource or DataSourceID property. The templates can contain static text, controls and special tags.

The HeaderTemplate property specifies the content template that will be displayed at the beginning, while FooterTemplate at the end. If present, these two templates will only be rendered when the repeater is given non-empty data. In this case, for each data item the content defined by ItemTemplate will be generated and displayed once. If AlternatingItemTemplate is not empty, then the corresponding content will be displayed alternatively with that in ItemTemplate. The content in SeparatorTemplate, if not empty, will be displayed between items.

Each repeater item has a TRepeaterItem::getItemType which tells the position of the item in the repeater. An item in the header of the repeater is of type TListItemType::Header. A body item may be of either TListItemType::Item or TListItemType::AlternatingItem, depending whether the item index is odd or even.

You can retrive the repeated contents by the Items property. The header and footer items can be accessed by Header and Footer properties, respectively.

When TRepeater creates an item, it will raise an OnItemCreated so that you may customize the newly created item. When databinding is performed by TRepeater, for each item once it has finished databinding, an OnItemDataBound event will be raised.

TRepeater raises an OnItemCommand whenever a button control within some repeater item raises a OnCommand event. Therefore, you can handle all sorts of OnCommand event in a central place by writing an event handler for OnItemCommand.

Note, the data bound to the repeater are reset to null after databinding. There are several ways to access the data associated with a repeater item:

the specified repeater item and use the key to fetch the corresponding data from some persistent storage such as DB.
  • Save the data in viewstate and get it back during postbacks.

  • since: 3.0
  • version: $Id: TRepeater.php 1482 2006-10-29 12:53:33Z xue $
  • author: Qiang Xue <qiang.xue@gmail.com>

Located in /Web/UI/WebControls/TRepeater.php (line 72)

TComponent
   |
   --TApplicationComponent
      |
      --TControl
         |
         --TWebControl
            |
            --TDataBoundControl
               |
               --TRepeater
Class Constant Summary
 IT_ALTERNATINGITEM = 'AlternatingItem'
 IT_FOOTER = 'Footer'
 IT_HEADER = 'Header'
 IT_ITEM = 'Item'
 IT_SEPARATOR = 'Separator'
Method Summary
Methods
bubbleEvent (line 484)

This method overrides parent's implementation to handle onItemCommand event which is bubbled from TRepeaterItem child controls.

This method should only be used by control developers.

  • return: whether the event bubbling should stop here.
  • access: public
boolean bubbleEvent (TControl $sender, TEventParameter $param)

Redefinition of:
TControl::bubbleEvent()
This method responds to a bubbled event.
createItem (line 302)

Creates a repeater item instance based on the item type and index.

  • return: created repeater item
  • access: protected
TRepeaterItem createItem (integer $itemIndex, string $itemType)
  • integer $itemIndex: zero-based item index
  • string $itemType: item type, may be 'Header', 'Footer', 'Empty', 'Item', 'Separator', 'AlternatingItem'.
getAlternatingItemTemplate (line 144)
  • return: the alternative template string for the item
  • access: public
ITemplate getAlternatingItemTemplate ()
getDataFieldValue (line 554)

Returns the value of the data at the specified field.

If data is an array, TMap or TList, the value will be returned at the index of the specified field. If the data is a component with a property named as the field name, the property value will be returned. Otherwise, an exception will be raised.

  • return: data value at the specified field
  • access: protected
  • throws: TInvalidDataValueException if the data is invalid
mixed getDataFieldValue (mixed $data, mixed $field)
  • mixed $data: data item
  • mixed $field: field name
getDataKeyField (line 270)
  • return: the field of the data source that provides the keys of the list items.
  • access: public
string getDataKeyField ()
getDataKeys (line 286)
  • return: the keys used in the data listing control.
  • access: public
TList getDataKeys ()
getEmptyTemplate (line 204)
  • return: the template applied when no data is bound to the repeater
  • access: public
ITemplate getEmptyTemplate ()
getFooter (line 252)
  • return: the footer item
  • access: public
TRepeaterItem getFooter ()
getFooterTemplate (line 184)
  • return: the footer template
  • access: public
ITemplate getFooterTemplate ()
getHeader (line 244)
  • return: the header item
  • access: public
TRepeaterItem getHeader ()
getHeaderTemplate (line 164)
  • return: the header template
  • access: public
ITemplate getHeaderTemplate ()
getItems (line 260)
getItemTemplate (line 124)
  • return: the template for repeater items
  • access: public
ITemplate getItemTemplate ()
getSeparatorTemplate (line 224)
  • return: the separator template
  • access: public
ITemplate getSeparatorTemplate ()
initializeItem (line 344)

Initializes a repeater item.

The item is added as a child of the repeater and the corresponding template is instantiated within the item.

  • access: protected
void initializeItem (TRepeaterItem $item)
loadState (line 388)

Loads item count information from viewstate.

This method is invoked right after control state is loaded.

  • access: public
void loadState ()

Redefinition of:
TControl::loadState()
This method is invoked right after the control has loaded its state.
onItemCommand (line 538)

Raises OnItemCommand event.

This method is invoked after a button control in a template raises Command event. The TRepeaterItem control responsible for the event can be determined from the event parameter. The event parameter also contains the information about the initial sender of the Command event, command name and command parameter. You may override this method to provide customized event handling. Be sure to call parent's implementation so that event handlers have chance to respond to the event.

  • access: public
void onItemCommand (TRepeaterCommandEventParameter $param)
onItemCreated (line 505)

Raises OnItemCreated event.

This method is invoked after a repeater item is created and instantiated with template, but before added to the page hierarchy. The TRepeaterItem control responsible for the event can be determined from the event parameter. If you override this method, be sure to call parent's implementation so that event handlers have chance to respond to the event.

  • access: public
void onItemCreated (TRepeaterItemEventParameter $param)
onItemDataBound (line 519)

Raises OnItemDataBound event.

This method is invoked right after an item is data bound. The TRepeaterItem control responsible for the event can be determined from the event parameter. If you override this method, be sure to call parent's implementation so that event handlers have chance to respond to the event.

  • access: public
void onItemDataBound (TRepeaterItemEventParameter $param)
performDataBinding (line 440)

Performs databinding to populate repeater items from data source.

This method is invoked by dataBind(). You may override this function to provide your own way of data population.

  • access: protected
void performDataBinding (Traversable $data)
  • Traversable $data: the data

Redefinition of:
TDataBoundControl::performDataBinding()
render (line 365)

Renders the repeater.

This method overrides the parent implementation by rendering the body content as the whole presentation of the repeater. Outer tag is not rendered.

  • access: public
void render (THtmlWriter $writer)

Redefinition of:
TWebControl::render()
Renders the control.
reset (line 399)

Clears up all items in the repeater.

  • access: public
void reset ()
restoreItemsFromViewState (line 410)

Creates repeater items based on viewstate information.

  • access: protected
void restoreItemsFromViewState ()
saveState (line 375)

Saves item count in viewstate.

This method is invoked right before control state is to be saved.

  • access: public
void saveState ()

Redefinition of:
TControl::saveState()
This method is invoked when control state is to be saved.
setAlternatingItemTemplate (line 153)
  • access: public
  • throws: TInvalidDataTypeException if the input is not an ITemplate or not null.
void setAlternatingItemTemplate (ITemplate $value)
  • ITemplate $value: the alternative item template
setDataKeyField (line 278)
  • access: public
void setDataKeyField (string $value)
  • string $value: the field of the data source that provides the keys of the list items.
setEmptyTemplate (line 213)
  • access: public
  • throws: TInvalidDataTypeException if the input is not an ITemplate or not null.
void setEmptyTemplate (ITemplate $value)
  • ITemplate $value: the template applied when no data is bound to the repeater
setFooterTemplate (line 193)
  • access: public
  • throws: TInvalidDataTypeException if the input is not an ITemplate or not null.
void setFooterTemplate (ITemplate $value)
setHeaderTemplate (line 173)
  • access: public
  • throws: TInvalidDataTypeException if the input is not an ITemplate or not null.
void setHeaderTemplate (ITemplate $value)
setItemTemplate (line 133)
  • access: public
  • throws: TInvalidDataTypeException if the input is not an ITemplate or not null.
void setItemTemplate (ITemplate $value)
  • ITemplate $value: the template for repeater items
setSeparatorTemplate (line 233)
  • access: public
  • throws: TInvalidDataTypeException if the input is not an ITemplate or not null.
void setSeparatorTemplate (ITemplate $value)

Inherited Methods

Inherited From TDataBoundControl

TDataBoundControl::createPagedDataSource()
TDataBoundControl::dataBind()
TDataBoundControl::dataSourceViewChanged()
TDataBoundControl::determineDataSource()
TDataBoundControl::ensureDataBound()
TDataBoundControl::getAllowCustomPaging()
TDataBoundControl::getAllowPaging()
TDataBoundControl::getCurrentPageIndex()
TDataBoundControl::getData()
TDataBoundControl::getDataMember()
TDataBoundControl::getDataSource()
TDataBoundControl::getDataSourceID()
TDataBoundControl::getDataSourceView()
TDataBoundControl::getInitialized()
TDataBoundControl::getIsDataBound()
TDataBoundControl::getPageCount()
TDataBoundControl::getPageSize()
TDataBoundControl::getRequiresDataBinding()
TDataBoundControl::getSelectParameters()
TDataBoundControl::getUsingDataSourceID()
TDataBoundControl::getVirtualItemCount()
TDataBoundControl::onDataBound()
TDataBoundControl::onDataSourceChanged()
TDataBoundControl::onInit()
TDataBoundControl::onPreRender()
TDataBoundControl::pagePreLoad()
TDataBoundControl::performDataBinding()
TDataBoundControl::setAllowCustomPaging()
TDataBoundControl::setAllowPaging()
TDataBoundControl::setCurrentPageIndex()
TDataBoundControl::setDataMember()
TDataBoundControl::setDataSource()
TDataBoundControl::setDataSourceID()
TDataBoundControl::setInitialized()
TDataBoundControl::setIsDataBound()
TDataBoundControl::setPageSize()
TDataBoundControl::setRequiresDataBinding()
TDataBoundControl::setVirtualItemCount()
TDataBoundControl::validateDataSource()

Inherited From TWebControl

TWebControl::addAttributesToRender()
TWebControl::copyBaseAttributes()
TWebControl::createStyle()
TWebControl::getAccessKey()
TWebControl::getBackColor()
TWebControl::getBorderColor()
TWebControl::getBorderStyle()
TWebControl::getBorderWidth()
TWebControl::getCssClass()
TWebControl::getFont()
TWebControl::getForeColor()
TWebControl::getHasStyle()
TWebControl::getHeight()
TWebControl::getStyle()
TWebControl::getTabIndex()
TWebControl::getTagName()
TWebControl::getToolTip()
TWebControl::getWidth()
TWebControl::render()
TWebControl::renderBeginTag()
TWebControl::renderContents()
TWebControl::renderEndTag()
TWebControl::setAccessKey()
TWebControl::setBackColor()
TWebControl::setBorderColor()
TWebControl::setBorderStyle()
TWebControl::setBorderWidth()
TWebControl::setCssClass()
TWebControl::setForeColor()
TWebControl::setHeight()
TWebControl::setStyle()
TWebControl::setTabIndex()
TWebControl::setToolTip()
TWebControl::setWidth()

Inherited From TControl

TControl::__construct()
TControl::addedControl()
TControl::addParsedObject()
TControl::addToPostDataLoader()
TControl::applyStyleSheetSkin()
TControl::autoBindProperty()
TControl::autoDataBindProperties()
TControl::bindProperty()
TControl::broadcastEvent()
TControl::bubbleEvent()
TControl::clearChildState()
TControl::clearControlState()
TControl::clearNamingContainer()
TControl::clearViewState()
TControl::createChildControls()
TControl::createControlCollection()
TControl::dataBind()
TControl::dataBindChildren()
TControl::dataBindProperties()
TControl::ensureChildControls()
TControl::findControl()
TControl::findControlsByID()
TControl::findControlsByType()
TControl::focus()
TControl::getAdapter()
TControl::getAllowChildControls()
TControl::getAttribute()
TControl::getAttributes()
TControl::getChildControlsCreated()
TControl::getClientID()
TControl::getControls()
TControl::getControlStage()
TControl::getControlState()
TControl::getCustomData()
TControl::getEnabled()
TControl::getEnableTheming()
TControl::getEnableViewState()
TControl::getHasAdapter()
TControl::getHasAttributes()
TControl::getHasChildInitialized()
TControl::getHasControls()
TControl::getHasInitialized()
TControl::getHasLoaded()
TControl::getHasLoadedPostData()
TControl::getHasPreRendered()
TControl::getID()
TControl::getNamingContainer()
TControl::getPage()
TControl::getParent()
TControl::getRegisteredObject()
TControl::getSkinID()
TControl::getSourceTemplateControl()
TControl::getTemplateControl()
TControl::getUniqueID()
TControl::getViewState()
TControl::getVisible()
TControl::hasAttribute()
TControl::initRecursive()
TControl::isDescendentOf()
TControl::isObjectRegistered()
TControl::loadRecursive()
TControl::loadState()
TControl::loadStateRecursive()
TControl::onDataBinding()
TControl::onInit()
TControl::onLoad()
TControl::onPreRender()
TControl::onUnload()
TControl::preRenderRecursive()
TControl::raiseBubbleEvent()
TControl::registerObject()
TControl::removeAttribute()
TControl::removedControl()
TControl::render()
TControl::renderChildren()
TControl::renderControl()
TControl::saveState()
TControl::saveStateRecursive()
TControl::setAdapter()
TControl::setAttribute()
TControl::setChildControlsCreated()
TControl::setControlStage()
TControl::setControlState()
TControl::setCustomData()
TControl::setEnabled()
TControl::setEnableTheming()
TControl::setEnableViewState()
TControl::setID()
TControl::setPage()
TControl::setSkinID()
TControl::setTemplateControl()
TControl::setViewState()
TControl::setVisible()
TControl::traverseChildControls()
TControl::unbindProperty()
TControl::unloadRecursive()
TControl::unregisterObject()
TControl::__get()

Inherited From TApplicationComponent

TApplicationComponent::getApplication()
TApplicationComponent::getRequest()
TApplicationComponent::getResponse()
TApplicationComponent::getService()
TApplicationComponent::getSession()
TApplicationComponent::getUser()
TApplicationComponent::publishAsset()
TApplicationComponent::publishFilePath()

Inherited From TComponent

TComponent::addParsedObject()
TComponent::attachEventHandler()
TComponent::canGetProperty()
TComponent::canSetProperty()
TComponent::createdOnTemplate()
TComponent::detachEventHandler()
TComponent::evaluateExpression()
TComponent::evaluateStatements()
TComponent::getEventHandlers()
TComponent::getSubProperty()
TComponent::hasEvent()
TComponent::hasEventHandler()
TComponent::hasProperty()
TComponent::raiseEvent()
TComponent::setSubProperty()
TComponent::__get()
TComponent::__set()
Class Constants

Documentation generated on Sun, 14 Jan 2007 21:44:05 -0500 by phpDocumentor 1.3.0RC4