summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Controls/Samples/TRepeater/RegionDisplay.php
blob: b659c889c4577d0602ae39f18fe1b0730038c850 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

class RegionDisplay extends TRepeaterItemRenderer
{
	/**
	 * This method is invoked when the data is being bound
	 * to the parent repeater.
	 * At this time, the <b>Data</b> is available which
	 * refers to the data row associated with the parent repeater item.
	 */
	public function onDataBinding($param)
	{
		parent::onDataBinding($param);
		$this->Repeater->DataSource=$this->Data['detail'];
		$this->Repeater->dataBind();
	}

	public function itemCreated($sender,$param)
	{
		static $itemIndex=0;
		$item=$param->Item;
		if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
			$item->Row->BackColor=$itemIndex%2 ? "#BFCFFF" : "#E6ECFF";
		$itemIndex++;
	}
}