From 2a962765f0b687988384294cdb4baf51e291680c Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 6 Feb 2007 22:44:55 +0000 Subject: updated QS pages. --- .../protected/pages/Controls/Repeater.page | 83 ++++++++++++++++------ 1 file changed, 62 insertions(+), 21 deletions(-) (limited to 'demos/quickstart/protected/pages/Controls/Repeater.page') diff --git a/demos/quickstart/protected/pages/Controls/Repeater.page b/demos/quickstart/protected/pages/Controls/Repeater.page index cc642c5a..69c6cdba 100644 --- a/demos/quickstart/protected/pages/Controls/Repeater.page +++ b/demos/quickstart/protected/pages/Controls/Repeater.page @@ -1,20 +1,39 @@

TRepeater

+

-TRepeater displays its content defined in templates repeatedly based on the given data specified by the DataSource or DataSourceID property. The repeated contents can be retrieved from the Items property. Each item is created by instantiating a template and each is a child control of the repeater. +TRepeater displays its content repeatedly based on the data fetched from DataSource. The repeated contents in TRepeater are called items which are controls accessible through Items property. When dataBind() is invoked, TRepeater creates an item for each row of data and binds the data row to the item. Optionally, a repeater can have a header, a footer and/or separators between items.

+

-Like normal control templates, the repeater templates can contain static text, controls and special tags, which after instantiation, become child contents of the corresponding item. TRepeater defines five templates for different purposes, +The layout of the repeated contents are specified by inline templates. In particular, repeater items, header, footer, etc. are being instantiated with the corresponding templates when data is being bound to the repeater. +

+ +

+Since v3.1.0, the layout can also be specified by renderers. A renderer is a control class that can be instantiated as repeater items, header, etc. A renderer can thus be viewed as an external template (in fact, it can also be non-templated controls). A renderer can be any control class. If implemented with one of the following interfaces, a renderer will be initialized with additional properties relevant to the repeater items:

+ -

+ + +

+The following properties are used to specify different types of template and renderer for a repeater. If an item type is defined with both a template and a renderer, the latter takes precedence. +

+ + + +

To populate data into the repeater items, set DataSource to a valid data object, such as array, TList, TMap, or a database table, and then call dataBind() for the repeater. That is,

@@ -28,32 +47,54 @@ class MyPage extends TPage { } } -

-Normally, you only need to do this when the page containing the repeater is initially requested. In postbacks, TRepeater is smart enough to remember the previous state, i.e., contents populated with datasource information.The following sample displays tabular data using TRepeater. + +

+When dataBind() is called, TRepeater undergoes the following lifecycles for each row of data:

-

-TRepeater provides several events to facilitate manipulation of its items, + +

    +
  1. create item based on templates or renderers
  2. +
  3. set the row of data to the item
  4. +
  5. raise an OnItemCreated event
  6. +
  7. add the item as a child control
  8. +
  9. call dataBind() of the item
  10. +
  11. raise an OnItemDataBound event
  12. +
+ +

+Normally, you only need to bind the data to repeater when the page containing the repeater is initially requested. When the page is post back, the repeater will restore automatically all its contents, including items, header, footer and separators. However, the data row associated with each item will not be recovered and thus become null.

-