The DataRepeater
The main difference between a DataGrid and a DataRepeater is that while a
DataGrid is in a table
and has structure to help define how that table should be rendered, a DataRepeater
lets you define your own structure for each item. You have a few different ways to do this:
- Specify a template file which will be rendered for each item visible.
- Subclass the DataRepeater object and override the GetItemHtml method, or the
GetItemAttributes and GetItemInnerHtml methods.
- Provide rendering callbacks, either with the ItemHtmlCallback, or the combination of the
ItemAttributesCallback and ItemInnerHtmlCallback attributes.
The DataRepeaters each have a Paginator defined with them. Note that
because the Paginator is rendered by the form (as opposed to the example
with DataGrid where the datagrid rendered the paginator), we will set the form
as the paginator's parent.
Also, note that DataRepeater allows you to set two paginators: a Paginator and a
PaginatorAlternate. This is to offer listing pages which have the paginator at the
top and at the bottom of the page.
The variables $_FORM, $_CONTROL and $_ITEM are pre-defined
for your template, and are set to the current Form, the DataRepeater object, and the data source item currently
being drawn.