summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample4.php
blob: aabab1576d2fe5c8a6250ae4d780900f77751060 (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
28
29
30
31
32
33
34
35
36
37
<?php

Prado::using('System.Collections.TDummyDataSource');

class Sample4 extends TPage
{
	public function onLoad($param)
	{
		parent::onLoad($param);
		if(!$this->IsPostBack)
		{
			// use a dummy data source to create 3 repeater items
			$this->Repeater->DataSource=new TDummyDataSource(3);
			$this->Repeater->dataBind();
		}
	}

	public function itemCreated($sender,$param)
	{
		// $param->Item refers to the newly created repeater item
		$param->Item->Style="width:300px; margin:10px; margin-left:0px";
	}

	public function buttonClicked($sender,$param)
	{
		$links=array();
		foreach($this->Repeater->Items as $textBox)
		{
			if($textBox->Text!=='')
				$links[]=$textBox->Text;
		}
		$this->Repeater2->DataSource=$links;
		$this->Repeater2->dataBind();
	}
}

?>