diff options
Diffstat (limited to 'demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater')
12 files changed, 15 insertions, 459 deletions
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample3.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.page index 1ea4e9dc..4d855cbc 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample3.page +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.page @@ -1,6 +1,6 @@ <com:TContent ID="body">
-<h1>TActiveRepeater Sample 3</h1>
+<h1>TActiveRepeater Sample</h1>
<p>
The following example allows users to modify the existing tabular data using a <tt>TActiveRepeater</tt>. Two validators are used in the repeater to ensure the validity of user inputs. One is to ensure product names are not empty, the other ensures product prices are valid numeric format. After clicking on the <tt>save</tt> button, the input data is displayed in a table at the bottom of the page.
@@ -13,40 +13,28 @@ The following example allows users to modify the existing tabular data using a < <th>Price</th>
<th>Imported</th>
</tr>
-<com:TRepeater ID="Repeater" OnItemDataBound="repeaterDataBound">
+<com:TActiveRepeater ID="Repeater" OnItemDataBound="repeaterDataBound">
<prop:ItemTemplate>
<tr>
<td>
- <com:TActiveTextBox
+ <com:TTextBox
ID="ProductName"
- Text=<%#$this->Data['name']%>
- AutoPostBack="true"
- OnTextChanged="Page.saveInput"
- OnCallback="Page.renderRepeater2"/>
+ Text=<%#$this->Data['name']%> />
</td>
<td>
- <com:TActiveDropDownList
- ID="ProductCategory"
- AutoPostBack="true"
- OnSelectedIndexChanged="Page.saveInput"
- OnCallback="Page.renderRepeater2"/>
+ <com:TDropDownList
+ ID="ProductCategory" />
</td>
<td>
- <com:TActiveTextBox
+ <com:TTextBox
ID="ProductPrice"
Columns="7"
- Text=<%#$this->Data['price']%>
- AutoPostBack="true"
- OnTextChanged="Page.saveInput"
- OnCallback="Page.renderRepeater2"/>
+ Text=<%#$this->Data['price']%> />
</td>
<td>
- <com:TActiveCheckBox
+ <com:TCheckBox
ID="ProductImported"
- Checked=<%#$this->Data['imported']%>
- AutoPostBack="true"
- OnCheckedChanged="Page.saveInput"
- OnCallback="Page.renderRepeater2"/>
+ Checked=<%#$this->Data['imported']%> />
<com:TRequiredFieldValidator
ControlToValidate="ProductName"
ErrorMessage="Product name cannot be empty."
@@ -59,15 +47,15 @@ The following example allows users to modify the existing tabular data using a < </td>
</tr>
</prop:ItemTemplate>
-</com:TRepeater>
+</com:TActiveRepeater>
</table>
<div>
-<com:TActiveButton Text="Save" OnClick="saveInput" OnCallback="renderRepeater2"/>
+<com:TActiveButton Text="Save" OnClick="saveInput"/>
</div>
<com:TSafeHtml>
-<com:TActiveRepeater ID="Repeater2" EnableViewState="false" >
+<com:TActiveRepeater ID="Repeater2" EnableViewState="false">
<prop:HeaderTemplate>
<table cellpadding="2">
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample3.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.php index 4cb5fafd..f7c8d61c 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample3.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.php @@ -1,6 +1,6 @@ <?php
-class Sample3 extends TPage
+class Home extends TPage
{
protected function getProducts()
{
@@ -31,7 +31,7 @@ class Sample3 extends TPage public function onLoad($param)
{
parent::onLoad($param);
- if(!$this->IsPostBack && ! $this->IsCallBack)
+ if(!$this->IsPostBack)
{
$this->Repeater->DataSource=$this->Products;
$this->Repeater->dataBind();
@@ -74,11 +74,6 @@ class Sample3 extends TPage $this->Repeater2->dataBind();
}
}
-
- public function renderRepeater2 ($sender, $param)
- {
- $this->Repeater2->render($param->getNewWriter());
- }
}
?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/RegionDisplay.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/RegionDisplay.php deleted file mode 100644 index 40d1841e..00000000 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/RegionDisplay.php +++ /dev/null @@ -1,28 +0,0 @@ -<?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++;
- }
-}
-
-?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/RegionDisplay.tpl b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/RegionDisplay.tpl deleted file mode 100644 index 0ab9b164..00000000 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/RegionDisplay.tpl +++ /dev/null @@ -1,34 +0,0 @@ -<tr>
-<com:TTableCell ID="Cell"
- ForeColor="white"
- BackColor="<%# $this->ItemIndex%2 ? '#6078BF' : '#809FFF' %>"
- Text="<%#$this->Data['name'] %>"
- />
-<td>
-
-<com:TActiveRepeater ID="Repeater" OnItemCreated="itemCreated">
-<prop:HeaderTemplate>
-<table cellspacing="1">
-</prop:HeaderTemplate>
-
-<prop:ItemTemplate>
-<com:TTableRow ID="Row">
- <com:TTableCell Width="70px">
- <%#$this->Data['name'] %>
- </com:TTableCell>
- <com:TTableCell Width="20">
- <%#$this->Data['age'] %>
- </com:TTableCell>
- <com:TTableCell Width="150px">
- <%#$this->Data['position'] %>
- </com:TTableCell>
-</com:TTableRow>
-</prop:ItemTemplate>
-
-<prop:FooterTemplate>
-</table>
-</prop:FooterTemplate>
-</com:TActiveRepeater>
-
-</td>
-</tr>
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample1.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample1.page deleted file mode 100644 index ec740487..00000000 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample1.page +++ /dev/null @@ -1,47 +0,0 @@ -<com:TContent ID="body">
-
-<h1>TActiveRepeater Sample 1</h1>
-
-<com:TActiveRepeater ID="Repeater" EnableViewState="false">
-
-<prop:HeaderTemplate>
-<table cellpadding="2">
-<tr style="color:white;background-color:black">
- <th>ID</th>
- <th>Name</th>
- <th>Quantity</th>
- <th>Price</th>
- <th>Imported</th>
-</tr>
-</prop:HeaderTemplate>
-
-<prop:ItemTemplate>
-<tr style="background-color:#BFCFFF">
-<td><%#$this->Data['id']%></td>
-<td><%#$this->Data['name']%></td>
-<td><%#$this->Data['quantity']%></td>
-<td><%#$this->Data['price']%></td>
-<td><%#$this->Data['imported']?'Yes':'No'%></td>
-</tr>
-</prop:ItemTemplate>
-
-<prop:AlternatingItemTemplate>
-<tr style="background-color:#E6ECFF">
-<td><%#$this->Data['id']%></td>
-<td><%#$this->Data['name']%></td>
-<td><%#$this->Data['quantity']%></td>
-<td><%#$this->Data['price']%></td>
-<td><%#$this->Data['imported']?'Yes':'No'%></td>
-</tr>
-</prop:AlternatingItemTemplate>
-
-<prop:FooterTemplate>
-<tr style="color:white;background-color:black;text-align:center;">
-<td colspan="5">Computer Parts Inventory</td>
-</tr>
-</table>
-</prop:FooterTemplate>
-
-</com:TActiveRepeater>
-
-<div class="last-modified">$Id: Sample1.page 1688 2007-02-09 22:48:31Z xue $</div></com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample1.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample1.php deleted file mode 100644 index 905a3b8d..00000000 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample1.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php
-
-class Sample1 extends TPage
-{
- protected function getData()
- {
- return array(
- array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
- array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
- array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>true),
- array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
- array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
- array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>false),
- array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>true),
- array('id'=>'ITN008','name'=>'CDRW drive','quantity'=>1,'price'=>40.00,'imported'=>true),
- array('id'=>'ITN009','name'=>'Cooling fan','quantity'=>2,'price'=>10.00,'imported'=>false),
- array('id'=>'ITN010','name'=>'Video camera','quantity'=>20,'price'=>30.00,'imported'=>true),
- array('id'=>'ITN011','name'=>'Card reader','quantity'=>10,'price'=>24.00,'imported'=>true),
- array('id'=>'ITN012','name'=>'Floppy drive','quantity'=>50,'price'=>12.00,'imported'=>false),
- array('id'=>'ITN013','name'=>'CD drive','quantity'=>25,'price'=>20.00,'imported'=>true),
- array('id'=>'ITN014','name'=>'DVD drive','quantity'=>15,'price'=>80.00,'imported'=>true),
- array('id'=>'ITN015','name'=>'Mouse pad','quantity'=>50,'price'=>5.00,'imported'=>false),
- array('id'=>'ITN016','name'=>'Network cable','quantity'=>40,'price'=>8.00,'imported'=>true),
- array('id'=>'ITN017','name'=>'Case','quantity'=>8,'price'=>65.00,'imported'=>false),
- array('id'=>'ITN018','name'=>'Surge protector','quantity'=>45,'price'=>15.00,'imported'=>false),
- array('id'=>'ITN019','name'=>'Speaker','quantity'=>35,'price'=>65.00,'imported'=>false),
- );
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->Repeater->DataSource=$this->getData();
- $this->Repeater->dataBind();
- }
- }
-}
-
-?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample2.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample2.page deleted file mode 100644 index bdb6ec2f..00000000 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample2.page +++ /dev/null @@ -1,58 +0,0 @@ -<com:TContent ID="body">
-
-<h1>TActiveRepeater Sample 2</h1>
-
-<com:TActiveRepeater ID="Repeater"
- EnableViewState="false"
- OnItemDataBound="dataBindRepeater2"
- OnItemCreated="repeaterItemCreated">
-
-<prop:HeaderTemplate>
-<table cellspacing="1" style="border:1px solid silver">
-</prop:HeaderTemplate>
-
-<prop:ItemTemplate>
-<tr>
-<com:TTableCell ID="Cell">
- <%#$this->Data %>
-</com:TTableCell>
-<td>
- <com:TActiveRepeater
- ID="Repeater2"
- EnableViewState="false"
- OnItemCreated="Page.repeater2ItemCreated">
-
- <prop:HeaderTemplate>
- <table cellspacing="1">
- </prop:HeaderTemplate>
-
- <prop:ItemTemplate>
- <com:TTableRow ID="Row">
- <com:TTableCell Width="70px">
- <%#$this->Data['name'] %>
- </com:TTableCell>
- <com:TTableCell Width="20">
- <%#$this->Data['age'] %>
- </com:TTableCell>
- <com:TTableCell Width="150px">
- <%#$this->Data['position'] %>
- </com:TTableCell>
- </com:TTableRow>
- </prop:ItemTemplate>
-
- <prop:FooterTemplate>
- </table>
- </prop:FooterTemplate>
-
- </com:TActiveRepeater>
-</td>
-</tr>
-</prop:ItemTemplate>
-
-<prop:FooterTemplate>
-</table>
-</prop:FooterTemplate>
-
-</com:TActiveRepeater>
-
-<div class="last-modified">$Id: Sample2.page 1688 2007-02-09 22:48:31Z xue $</div></com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample2.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample2.php deleted file mode 100644 index e84580a2..00000000 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample2.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php
-
-class Sample2 extends TPage
-{
- protected function getMasterData()
- {
- return array('North','West','East','South');
- }
-
- protected function getDetailData($region)
- {
- static $data=array(
- 'North'=>array(
- array('name'=>'John','age'=>30,'position'=>'Program Manager'),
- array('name'=>'Edward','age'=>35,'position'=>'Developer'),
- array('name'=>'Walter','age'=>28,'position'=>'Developer'),
- ),
- 'West'=>array(
- array('name'=>'Cary','age'=>31,'position'=>'Senior Manager'),
- array('name'=>'Ted','age'=>25,'position'=>'Developer'),
- array('name'=>'Kevin','age'=>28,'position'=>'Developer'),
- ),
- 'East'=>array(
- array('name'=>'Shawn','age'=>30,'position'=>'Sales Manager'),
- array('name'=>'Larry','age'=>28,'position'=>'Document Writer'),
- ),
- 'South'=>array(
- array('name'=>'King','age'=>30,'position'=>'Program Manager'),
- array('name'=>'Carter','age'=>22,'position'=>'Developer'),
- ),
- );
- return $data[$region];
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->Repeater->DataSource=$this->getMasterData();
- $this->Repeater->dataBind();
- }
- }
-
- public function dataBindRepeater2($sender,$param)
- {
- $item=$param->Item;
- if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
- {
- $item->Repeater2->DataSource=$this->getDetailData($item->DataItem);
- $item->Repeater2->dataBind();
- }
- }
-
- public function repeaterItemCreated($sender,$param)
- {
- static $itemIndex=0;
- $item=$param->Item;
- if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
- {
- $item->Cell->BackColor=$itemIndex%2 ? "#6078BF" : "#809FFF";
- $item->Cell->ForeColor='white';
- $itemIndex++;
- }
- }
-
- public function repeater2ItemCreated($sender,$param)
- {
- static $itemIndex=0;
- $item=$param->Item;
- if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
- {
- $item->Row->BackColor=$itemIndex%2 ? "#BFCFFF" : "#E6ECFF";
- $itemIndex++;
- }
- }
-}
-
-?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample4.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample4.page deleted file mode 100644 index b4bb622c..00000000 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample4.page +++ /dev/null @@ -1,27 +0,0 @@ -<com:TContent ID="body">
-
-<h1>TActiveRepeater Sample 4</h1>
-
-<p>Please enter the URL of your favorite websites in the following:</p>
-<com:TActiveRepeater ID="Repeater"
- OnItemCreated="itemCreated"
- ItemRenderer="TTextBox"
- />
-
-<br/>
-
-<com:TActiveButton Text="Submit" OnClick="buttonClicked" OnCallback="redrawRepeater2"/>
-
-<br/><br/>
-
-<com:TActiveLabel id="lblResult" Text="You have entered the following URLs:"
- Display="None" />
-<br/>
-
-<com:TActiveRepeater ID="Repeater2"
- OnItemCreated="itemCreated"
- ItemRenderer="THyperLink"
- />
-
-
-<div class="last-modified">$Id: Sample4.page 1688 2007-02-09 22:48:31Z xue $</div></com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample4.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample4.php deleted file mode 100644 index 0b42436e..00000000 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample4.php +++ /dev/null @@ -1,43 +0,0 @@ -<?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();
- }
-
- public function redrawRepeater2($sender,$param)
- {
- $this->lblResult->setDisplay(TDisplayStyle::Dynamic);
- $this->Repeater2->render($param->NewWriter);
- }
-}
-
-?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample5.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample5.page deleted file mode 100644 index ee9992d9..00000000 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample5.page +++ /dev/null @@ -1,18 +0,0 @@ -<com:TContent ID="body">
-
-<h1>TActiveRepeater Sample 5</h1>
-
-<com:TActiveRepeater ID="Repeater"
- ItemRenderer="Application.pages.ActiveControls.Samples.TActiveRepeater.RegionDisplay">
-
-<prop:HeaderTemplate>
-<table cellspacing="1" style="border:1px solid silver">
-</prop:HeaderTemplate>
-
-<prop:FooterTemplate>
-</table>
-</prop:FooterTemplate>
-
-</com:TActiveRepeater>
-
-<div class="last-modified">$Id: $</div></com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample5.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample5.php deleted file mode 100644 index 60beb30e..00000000 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Sample5.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php
-
-class Sample5 extends TPage
-{
- protected function getData()
- {
- return array(
- array(
- 'name'=>'North',
- 'detail'=>array(
- array('name'=>'John','age'=>30,'position'=>'Program Manager'),
- array('name'=>'Edward','age'=>35,'position'=>'Developer'),
- array('name'=>'Walter','age'=>28,'position'=>'Developer'),
- ),
- ),
- array(
- 'name'=>'West',
- 'detail'=>array(
- array('name'=>'Cary','age'=>31,'position'=>'Senior Manager'),
- array('name'=>'Ted','age'=>25,'position'=>'Developer'),
- array('name'=>'Kevin','age'=>28,'position'=>'Developer'),
- ),
- ),
- array(
- 'name'=>'East',
- 'detail'=>array(
- array('name'=>'Shawn','age'=>30,'position'=>'Sales Manager'),
- array('name'=>'Larry','age'=>28,'position'=>'Document Writer'),
- ),
- ),
- array(
- 'name'=>'South',
- 'detail'=>array(
- array('name'=>'King','age'=>30,'position'=>'Program Manager'),
- array('name'=>'Carter','age'=>22,'position'=>'Developer'),
- ),
- ),
- );
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->Repeater->DataSource=$this->getData();
- $this->Repeater->dataBind();
- }
- }
-}
-
-?>
\ No newline at end of file |