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.

Previous|1234|Next
Person #1
First Name: John
Last Name: Doe
Person #2
First Name: Kendall
Last Name: Public

Person #3
First Name: Ben
Last Name: Robinson
Person #4
First Name: Mike
Last Name: Ho

Person #5
First Name: Alex
Last Name: Smith
Person #6
First Name: Wendy
Last Name: Smith

Previous|1234|Next

Previous|12345678100|Next
  • Item number 1
  • Item number 2
  • Item number 3
  • Item number 4
  • Item number 5
  • Item number 6
  • Item number 7
  • Item number 8
  • Item number 9
  • Item number 10