summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Controls/Samples/TRepeater
diff options
context:
space:
mode:
authorxue <>2006-01-31 21:27:51 +0000
committerxue <>2006-01-31 21:27:51 +0000
commitbbb5ba2761529a2f477589623b2b76b10d6f8803 (patch)
tree0a038fe9376e4226a5c08a9dec2f39215d526f6e /demos/quickstart/protected/pages/Controls/Samples/TRepeater
parenta349f11b4caec0d7e82e3327d79db1b0a30642fc (diff)
Split TTable.php file into individual class files. Modified TRepeater demo 2.
Diffstat (limited to 'demos/quickstart/protected/pages/Controls/Samples/TRepeater')
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.page64
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.php21
2 files changed, 52 insertions, 33 deletions
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.page b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.page
index dbfc7a18..bb78c35a 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.page
+++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.page
@@ -3,46 +3,44 @@
<h1>TRepeater Sample 2</h1>
<com:TRepeater ID="Repeater"
- OnItemDataBound="dataBindRepeater2">
+ OnItemDataBound="dataBindRepeater2"
+ OnItemCreated="repeaterItemCreated">
<prop:HeaderTemplate>
-<table cellspacing="1" style="border-collapse: collapse;border:1px solid silver">
-<tr style="color:white;background-color:black">
-<th colspan="2">Regional Personnel</th>
-</tr>
+<table cellspacing="1" style="border-collapse:collapse;border:1px solid silver">
</prop:HeaderTemplate>
<prop:ItemTemplate>
<tr>
-<td style="background-color:silver"><%#$this->Parent->DataItem %></td>
+<com:TTableCell ID="Cell">
+ <%#$this->NamingContainer->DataItem %>
+</com:TTableCell>
<td>
- <com:TRepeater ID="Repeater2">
-
- <prop:HeaderTemplate>
- <table cellspacing="1" style="border-collapse: collapse;border:1px solid silver">
- </prop:HeaderTemplate>
-
- <prop:ItemTemplate>
- <tr style="background-color:#E6FFE6;">
- <td style="width:70px"><%#$this->Parent->DataItem['name'] %></td>
- <td style="width:20px"><%#$this->Parent->DataItem['age'] %></td>
- <td style="width:150px"><%#$this->Parent->DataItem['position'] %></td>
- </tr>
- </prop:ItemTemplate>
-
- <prop:AlternatingItemTemplate>
- <tr style="background-color:#F0F0F0;">
- <td style="width:70px"><%#$this->Parent->DataItem['name'] %></td>
- <td style="width:20px"><%#$this->Parent->DataItem['age'] %></td>
- <td style="width:150px"><%#$this->Parent->DataItem['position'] %></td>
- </tr>
- </prop:AlternatingItemTemplate>
-
- <prop:FooterTemplate>
- </table>
- </prop:FooterTemplate>
-
- </com:TRepeater>
+ <com:TRepeater ID="Repeater2" OnItemCreated="Page.repeater2ItemCreated">
+
+ <prop:HeaderTemplate>
+ <table cellspacing="1" style="border-collapse: collapse;">
+ </prop:HeaderTemplate>
+
+ <prop:ItemTemplate>
+ <com:TTableRow ID="Row">
+ <com:TTableCell Width="70px">
+ <%#$this->NamingContainer->DataItem['name'] %>
+ </com:TTableCell>
+ <com:TTableCell Width="20">
+ <%#$this->NamingContainer->DataItem['age'] %>
+ </com:TTableCell>
+ <com:TTableCell Width="150px">
+ <%#$this->NamingContainer->DataItem['position'] %>
+ </com:TTableCell>
+ </com:TTableRow>
+ </prop:ItemTemplate>
+
+ <prop:FooterTemplate>
+ </table>
+ </prop:FooterTemplate>
+
+ </com:TRepeater>
</td>
</tr>
</prop:ItemTemplate>
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.php b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.php
index a46a3327..96096a8a 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.php
@@ -51,6 +51,27 @@ class Sample2 extends TPage
$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