diff options
Diffstat (limited to 'demos')
33 files changed, 441 insertions, 616 deletions
diff --git a/demos/quickstart/protected/pages/ActiveControls/ActiveDataGrid.page b/demos/quickstart/protected/pages/ActiveControls/ActiveDataGrid.page new file mode 100644 index 00000000..9a82743d --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/ActiveDataGrid.page @@ -0,0 +1,83 @@ +<com:TContent ID="body" >
+
+<h1 id="5201">TActiveDataGrid</h1>
+<com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveDataGrid" />
+
+<p class="block-content">
+<tt>TActiveDataGrid</tt> represents a data bound and updatable grid control which is the
+active counterpart to the original <tt>TDataGrid</tt> control.
+</p>
+
+<p class="block-content">
+This component can be used in the same way as the regular datagrid, the only
+difference is that the active datagrid uses callbacks instead of postbacks
+for interaction.
+</p>
+
+<p class="block-content">
+PRADO provides eight new types of active columns that can be used inside <tt>TActiveDataGrid</tt>;
+they are the active counterpart of <tt>TDataGrid</tt>'s columns:
+</p>
+<ul class="block-content">
+ <li><tt>TActiveBoundColumn</tt> associates cells with a specific field of data and displays the cells according to their modes.</li>
+ <li><tt>TActiveLiteralColumn</tt> associates cells with a specific field of data and displays the cells with static texts.</li>
+ <li><tt>TActiveCheckBoxColumn</tt> associates cells with a specific field of data and displays in each cell a checkbox whose check state is determined by the data field value.</li>
+ <li><tt>TActiveDropDownListColumn</tt> associates cells with a specific field of data and displays the cells according to their modes. If in edit mode, a cell will be displayed with a <tt>TDropDownList</tt>.</li>
+ <li><tt>TActiveHyperLinkColumn</tt> displays in the cells a hyperlink whose caption and URL can be either statically specified or bound to some fields of data.</li>
+ <li><tt>TActiveEditCommandColumn</tt> displays in the cells edit/update/cancel command buttons according to the state of the item that a cell resides in.</li>
+ <li><tt>TActiveButtonColumn</tt> displays in the cells a command button.</li>
+ <li><tt>TActiveTemplateColumn</tt> displays the cells according to different templates defined for it.</li>
+</ul>
+
+<p class="block-content">
+Please refer to the original documentation of <a href="?page=Controls.DataGrid">TDataGrid</a> for basic usage.
+</p>
+
+
+<h2>Columns</h2>
+
+<h3>Automatically Generated Columns</h3>
+<p class="block-content">
+TDataGrid by default will create a list of columns based on the structure of the bound data. TDataGrid will read the first row of the data, extract the field names of the row, and construct a column for each field. Each column is of type <tt>TActiveBoundColumn</tt>. All of this happens in an ajax callback.
+</p>
+
+<com:RunBar PagePath="ActiveControls.Samples.TActiveDataGrid.Sample1" />
+
+<h3>Manually Specified Columns</h3>
+<p class="block-content">
+The following example uses manually specified columns to show a list of book information,
+</p>
+<ul id="u4" class="block-content">
+ <li>Book title - displayed as a hyperlink pointing to the corresponding amazon.com book page. <tt>TActiveHyperLinkColumn</tt> is used.</li>
+ <li>Publisher - displayed as a piece of text using <tt>TvBoundColumn</tt>.</li>
+ <li>Price - displayed as a piece of text using <tt>TActiveBoundColumn</tt> with output formatting string and customized styles.</li>
+ <li>In-stock or not - displayed as a checkbox using <tt>TActiveCheckBoxColumn</tt>.</li>
+ <li>Rating - displayed as an image using <tt>TActiveTemplateColumn</tt> which allows maximum freedom in specifying cell contents.</li>
+</ul>
+<p class="block-content">
+Each column can be shown or hidden in a callback.
+</p>
+<com:RunBar PagePath="ActiveControls.Samples.TActiveDataGrid.Sample2" />
+
+
+<h2>Interacting with TActiveDataGrid</h2>
+<p class="block-content">
+The following example shows how to make the previous book information table an interactive one. It allows users to edit and delete book items from the table. Two additional columns are used in the example to allow users interact with the datagrid: <tt>TActiveEditCommandColumn</tt> and <tt>TActiveButtonColumn</tt>. In addition,
+<tt>TActiveDropDownListColumn</tt> replaces the previous <tt>TActiveTemplateColumn</tt> to allow users to select a rating from a dropdown list. Note, it is also possible to use <tt>TActiveTemplateColumn</tt> to achieve the same task.
+All the iteration is done using AJAX callbacks.
+</p>
+<com:RunBar PagePath="ActiveControls.Samples.TActiveDataGrid.Sample3" />
+
+<h2>Sorting</h2>
+<p class="block-content">
+The following example turns the datagrid in <a href="?page=ActiveControls.Samples.TActiveDataGrid.Sample2">Example 2</a> into a sortable one. Users can click on the link button displayed in the header of any column, and the data will be sorted in ascending order along that column. The grid is sorted and rendered upon a callback request.
+</p>
+<com:RunBar PagePath="ActiveControls.Samples.TActiveDataGrid.Sample4" />
+
+<h2>Paging</h2>
+<p class="block-content">
+The following example enables the paging functionality of the datagrid shown in <a href="?page=ActiveControls.Samples.TActiveDataGrid.Sample1">Example 1</a>. In this example, you move between the datagrid pages clicking on the pager links. The grid reacts to paging rendering itself as the result of a callback request. Note that you can't change the pager style upon callback.
+</p>
+<com:RunBar PagePath="ActiveControls.Samples.TActiveDataGrid.Sample5" />
+
+<div class="last-modified">$Id$</div></com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/ActiveDataList.page b/demos/quickstart/protected/pages/ActiveControls/ActiveDataList.page new file mode 100644 index 00000000..12fb941f --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/ActiveDataList.page @@ -0,0 +1,23 @@ +<com:TContent ID="body" >
+
+<h1>TActiveDataList</h1>
+<com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveDataList" />
+
+<p class="block-content">
+<tt>TActiveDataList</tt> represents a data bound and updatable list control which is the
+active counterpart to the original <tt>TDataList</tt> control.
+</p>
+
+<p class="block-content">
+This component can be used in the same way as the regular datalist, the only
+difference is that the active datalist uses callbacks instead of postbacks
+for interaction.
+</p>
+
+<p class="block-content">
+Please refer to the original documentation of <a href="?page=Controls.DataList">TDataList</a> for usage.
+</p>
+
+<com:RunBar PagePath="ActiveControls.Samples.TActiveDataList.Home" />
+
+<div class="last-modified">$Id$</div></com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/ActiveRepeater.page b/demos/quickstart/protected/pages/ActiveControls/ActiveRepeater.page new file mode 100644 index 00000000..d22a7467 --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/ActiveRepeater.page @@ -0,0 +1,24 @@ +<com:TContent ID="body" >
+
+<h1>TActiveRepeater</h1>
+<com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveRepeater" />
+
+<p class="block-content">
+<tt>TActiveRepeater</tt> represents a data bound and updatable repeater control which is the
+active counterpart to the original <tt>TRepeater</tt> control.
+</p>
+
+<p class="block-content">
+This component can be used in the same way as the regular repeater, the only
+difference is that the active repeater uses callbacks instead of postbacks
+for interaction.
+</p>
+
+<p class="block-content">
+Please refer to the original documentation of <a href="?page=Controls.Repeater">TRepeater</a> for usage.
+</p>
+
+<com:RunBar PagePath="ActiveControls.Samples.TActiveRepeater.Home" />
+
+
+<div class="last-modified">$Id$</div></com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Home.page b/demos/quickstart/protected/pages/ActiveControls/Home.page index 93b5b6eb..798bc267 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Home.page +++ b/demos/quickstart/protected/pages/ActiveControls/Home.page @@ -136,19 +136,19 @@ TActiveButton</a> control. See also the later part of the <a href="?page=Tutoria <h2 id="134001">Active Data Controls</h2>
<ul id="u2" class="block-content">
<li>
- * <a href="?page=ActiveControls.ActiveDataList">TActiveDataList</a>
+ <a href="?page=ActiveControls.ActiveDataList">TActiveDataList</a>
is used to display or modify a list of data items. It is the
active counterpart to the original TDataList control.
</li>
<li>
- * <a href="?page=ActiveControls.ActiveDataGrid">TActiveDataGrid</a>
+ <a href="?page=ActiveControls.ActiveDataGrid">TActiveDataGrid</a>
displays data in a tabular format with rows and columns. It is the
active counterpart to the original TDataGrid control.
</li>
<li>
- * <a href="?page=ActiveControls.ActiveRepeater">TActiveRepeater</a>
+ <a href="?page=ActiveControls.ActiveRepeater">TActiveRepeater</a>
displays its content defined in templates repeatedly based on the given data.
It is the active counterpart to the original TRepeater control.
</li>
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.page index db537902..967cdf6f 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.page +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.page @@ -3,6 +3,7 @@ <h1>TActiveDataGrid Sample 1</h1>
<h2>Using Automatically Generated Columns</h2>
+<com:TActiveButton ID="button1" Text="click me" OnCallback="buttonClicked" />
<com:TActiveDataGrid
ID="DataGrid"
EnableViewState="false"
@@ -14,4 +15,4 @@ AlternatingItemStyle.BackColor="#E6ECFF"
/>
-<div class="last-modified">$Id: Sample1.page 1650 2007-01-24 06:55:32Z wei $</div></com:TContent>
\ No newline at end of file +<div class="last-modified">$Id: Sample1.page 2955 2011-06-02 09:30:55Z ctrlaltca@gmail.com $</div></com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.php index ec78006b..ada1ee6e 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.php @@ -27,14 +27,10 @@ class Sample1 extends TPage );
}
- public function onLoad($param)
+ public function buttonClicked($sender, $param)
{
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
}
}
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.page index 851fd157..176f14c8 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.page +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.page @@ -14,18 +14,18 @@ ItemStyle.Font.Italic="true"
AlternatingItemStyle.BackColor="#E6ECFF">
- <com:THyperLinkColumn
+ <com:TActiveHyperLinkColumn
HeaderText="Book Title"
DataTextField="title"
DataNavigateUrlField="ISBN"
DataNavigateUrlFormatString="http://www.amazon.com/gp/product/%s"
Target="_blank"
/>
- <com:TBoundColumn
+ <com:TActiveBoundColumn
HeaderText="Publisher"
DataField="publisher"
/>
- <com:TBoundColumn
+ <com:TActiveBoundColumn
ItemStyle.HorizontalAlign="Right"
ItemStyle.Wrap="false"
ItemStyle.Font.Italic="false"
@@ -34,25 +34,24 @@ DataField="price"
DataFormatString="$%.2f"
/>
- <com:TCheckBoxColumn
+ <com:TActiveCheckBoxColumn
HeaderText="In-stock"
HeaderStyle.Wrap="false"
DataField="instock"
/>
- <com:TTemplateColumn>
+ <com:TActiveTemplateColumn>
<prop:HeaderTemplate>Rating</prop:HeaderTemplate>
<prop:ItemTemplate>
<img src="images/star<%#$this->Parent->DataItem['rating']%>.gif" alt="" />
</prop:ItemTemplate>
- </com:TTemplateColumn>
+ </com:TActiveTemplateColumn>
</com:TActiveDataGrid>
<com:TPanel GroupingText="Column Visibility" Width="200px">
<com:TActiveCheckBoxList
AutoPostBack="true"
- OnSelectedIndexChanged="toggleColumnVisibility"
- OnCallback="redraw">
+ OnSelectedIndexChanged="toggleColumnVisibility">
<com:TListItem Text="Book Title" Selected="true" />
<com:TListItem Text="Publisher" Selected="true" />
<com:TListItem Text="Price" Selected="true" />
@@ -62,4 +61,4 @@ </com:TPanel>
-<div class="last-modified">$Id: Sample2.page 1650 2007-01-24 06:55:32Z wei $</div></com:TContent>
\ No newline at end of file +<div class="last-modified">$Id: Sample2.page 2955 2011-06-02 09:30:55Z ctrlaltca@gmail.com $</div></com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.php index 486d9d51..3831582d 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.php @@ -67,7 +67,7 @@ class Sample2 extends TPage public function onLoad($param)
{
parent::onLoad($param);
- if(!$this->IsPostBack)
+ if(!$this->IsPostBack && !$this->IsCallBack)
{
$this->DataGrid->DataSource=$this->Data;
$this->DataGrid->dataBind();
@@ -81,11 +81,6 @@ class Sample2 extends TPage $this->DataGrid->DataSource=$this->Data;
$this->DataGrid->dataBind();
}
-
- public function redraw($sender,$param)
- {
- $this->DataGrid->render($param->NewWriter);
- }
}
?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.page index 94aa95fe..4da3aa93 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.page +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.page @@ -50,7 +50,7 @@ HeaderText="In-stock"
DataField="instock"
/>
- <com:TActiveDropDownListColumn
+ <com:TActiveDropDownListColumn
ID="RatingColumn"
HeaderText="Rating"
DataTextField="rating"
@@ -80,4 +80,4 @@ />
</com:TActiveDataGrid>
-<div class="last-modified">$Id: Sample3.page 1650 2007-01-24 06:55:32Z wei $</div></com:TContent>
\ No newline at end of file +<div class="last-modified">$Id: Sample3.page 2955 2011-06-02 09:30:55Z ctrlaltca@gmail.com $</div></com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.php index bb18f36b..9768ca31 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.php @@ -125,7 +125,7 @@ class Sample3 extends TPage public function onLoad($param)
{
parent::onLoad($param);
- if(!$this->IsPostBack)
+ if(!$this->IsPostBack && !$this->IsCallBack)
{
$this->DataGrid->DataSource=$this->Data;
$this->DataGrid->dataBind();
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.page index 76a2bb86..485c8621 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.page +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.page @@ -52,4 +52,4 @@ </com:TActiveTemplateColumn>
</com:TActiveDataGrid>
-<div class="last-modified">$Id: Sample4.page 1650 2007-01-24 06:55:32Z wei $</div></com:TContent>
\ No newline at end of file +<div class="last-modified">$Id: Sample4.page 2955 2011-06-02 09:30:55Z ctrlaltca@gmail.com $</div></com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php index 80a9c8bc..eb1a0e5b 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php @@ -11,7 +11,7 @@ class Sample4 extends Sample2 return $data ;
}
- public function sorTActiveDataGrid($sender,$param)
+ public function sortDataGrid($sender,$param)
{
$this->DataGrid->DataSource=$this->sortData($this->Data,$param->SortExpression);
$this->DataGrid->dataBind();
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.page index a912c0d3..e2b99057 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.page +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.page @@ -22,41 +22,4 @@ />
</div>
-<com:TActivePanel GroupingText="Pager Visibility" Width="300px">
-
-<com:TActiveCheckBoxList
- AutoPostBack="true"
- RepeatColumns="2"
- OnSelectedIndexChanged="changePagerPosition" OnCallback="redrawDG">
- <com:TListItem Text="Top" />
- <com:TListItem Text="Bottom" Selected="true" />
-</com:TActiveCheckBoxList>
-
-</com:TActivePanel>
-
-<com:TActivePanel GroupingText="Pager Mode" Width="300px">
-
-<com:TActivePanel GroupingText="NextPrev Pager" Width="300px">
-
-Next Page Text:
-<com:TActiveTextBox ID="NextPageText" Text="Next" /><br/>
-Prev Page Text:
-<com:TActiveTextBox ID="PrevPageText" Text="Prev" /><br/>
-<com:TActiveButton Text="Submit" OnClick="useNextPrevPager" OnCallback="redrawDG"/>
-</com:TActivePanel>
-
-<com:TActivePanel GroupingText="Numeric Pager" Width="300px">
-
-Page Button Count:
-<com:TActiveTextBox ID="PageButtonCount" Text="5" /><br/>
-<com:TActiveButton Text="Submit" OnClick="useNumericPager" OnCallback="redrawDG"/>
-</com:TActivePanel>
-
-<com:TActivePanel GroupingText="Page Size" Width="300px">
-<com:TActiveTextBox ID="PageSize" Text="5" /><br/>
-<com:TActiveButton Text="Submit" OnClick="changePageSize" OnCallback="redrawDG"/>
-</com:TActivePanel>
-
-</com:TActivePanel>
-
-<div class="last-modified">$Id: Sample5.page 1650 2007-01-24 06:55:32Z wei $</div></com:TContent>
\ No newline at end of file +<div class="last-modified">$Id: Sample5.page 2955 2011-06-02 09:30:55Z ctrlaltca@gmail.com $</div></com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.php index 37347c7b..95bf9a0e 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.php @@ -4,6 +4,17 @@ Prado::using('Application.pages.ActiveControls.Samples.TActiveDataGrid.Sample1') class Sample5 extends Sample1
{
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostback && ! $this->IsCallback)
+ {
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+ }
+
public function changePage($sender,$param)
{
$this->DataGrid->CurrentPageIndex=$param->NewPageIndex;
@@ -63,11 +74,6 @@ class Sample5 extends Sample1 $this->DataGrid->DataSource=$this->Data;
$this->DataGrid->dataBind();
}
-
- public function redrawDG ($sender, $param)
- {
- $this->DataGrid->render($param->newWriter);
- }
}
?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample6.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample6.page deleted file mode 100644 index dd3fcdf8..00000000 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample6.page +++ /dev/null @@ -1,26 +0,0 @@ -<com:TContent ID="body">
-
-<h1>TActiveDataGrid Sample 6</h1>
-<h2>Custom Paging</h2>
-
-<div style="width:500px">
-<com:TActiveDataGrid
- ID="DataGrid"
- Width="100%"
- AllowPaging="true"
- AllowCustomPaging="true"
- VirtualItemCount="19"
- PageSize="5"
- PagerStyle.Mode="Numeric"
- PagerStyle.HorizontalAlign="Right"
- CellPadding="2"
- HeaderStyle.BackColor="black"
- HeaderStyle.ForeColor="white"
- ItemStyle.BackColor="#BFCFFF"
- ItemStyle.Font.Italic="true"
- AlternatingItemStyle.BackColor="#E6ECFF"
- OnPageIndexChanged="changePage"
- />
-</div>
-
-<div class="last-modified">$Id: Sample6.page 1650 2007-01-24 06:55:32Z wei $</div></com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample6.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample6.php deleted file mode 100644 index 7b217e24..00000000 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample6.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php
-
-Prado::using('Application.pages.ActiveControls.Samples.TActiveDataGrid.Sample1');
-
-class Sample6 extends Sample1
-{
- /**
- * Returns a subset of data.
- * In MySQL database, this can be replaced by LIMIT clause
- * in an SQL select statement.
- * @param integer the starting index of the row
- * @param integer number of rows to be returned
- * @return array subset of data
- */
- protected function getDataRows($offset,$rows)
- {
- $data=$this->getData();
- $page=array();
- for($i=0;$i<$rows;++$i)
- {
- if($offset+$i<$this->getRowCount())
- $page[$i]=$data[$offset+$i];
- }
- return $page;
- }
-
- /**
- * Returns total number of data rows.
- * In real DB applications, this may be replaced by an SQL select
- * query with count().
- * @return integer total number of data rows
- */
- protected function getRowCount()
- {
- return 19;
- }
-
- public function onLoad($param)
- {
- if(!$this->IsPostBack)
- {
- $this->DataGrid->DataSource=$this->getDataRows(0,$this->DataGrid->PageSize);
- $this->DataGrid->dataBind();
- }
- }
-
- public function changePage($sender,$param)
- {
- $this->DataGrid->CurrentPageIndex=$param->NewPageIndex;
- $offset=$param->NewPageIndex*$this->DataGrid->PageSize;
- $this->DataGrid->DataSource=$this->getDataRows($offset,$this->DataGrid->PageSize);
- $this->DataGrid->dataBind();
- }
-}
-
-?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.page new file mode 100644 index 00000000..ebd88424 --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.page @@ -0,0 +1,125 @@ +<com:TContent ID="body">
+
+<h1>TActiveDataList Sample</h1>
+
+<com:TActiveDataList
+ ID="DataList"
+ DataKeyField="id"
+ OnEditCommand="editItem"
+ OnCancelCommand="cancelItem"
+ OnUpdateCommand="updateItem"
+ OnDeleteCommand="deleteItem"
+ OnSelectedIndexChanged="selectItem"
+ HeaderStyle.BackColor="black"
+ HeaderStyle.ForeColor="white"
+ ItemStyle.BackColor="#BFCFFF"
+ AlternatingItemStyle.BackColor="#E6ECFF"
+ EditItemStyle.BackColor="lightgreen"
+ SelectedItemStyle.BackColor="lightyellow">
+
+<prop:HeaderTemplate>
+<div style="font-weight:bold; text-align:center;">Computer Parts</div>
+</prop:HeaderTemplate>
+
+<prop:ItemTemplate>
+<table border="0" width="100%">
+<tr>
+ <td>
+ <com:TActiveLinkButton
+ Text=<%#$this->DataItem['id']%>
+ CommandName="select"
+ />
+ <%#$this->DataItem['name']%>
+ </td>
+ <td align="right">
+ <com:TActiveLinkButton
+ Text="Edit"
+ CommandName="edit"
+ />
+ <com:TActiveLinkButton
+ Text="Delete"
+ CommandName="delete"
+ Attributes.onclick="if(!confirm('Are you sure?')) return false;"
+ />
+ </td>
+</tr>
+</table>
+</prop:ItemTemplate>
+
+<prop:SelectedItemTemplate>
+<table border="1" width="100%">
+<tr>
+ <th>ID</th><th>Name</th><th>Quantity</th><th>Price</th>
+</tr>
+<tr>
+ <td align="right"><%#$this->DataItem['id'] %></td>
+ <td align="right"><%#$this->DataItem['name'] %></td>
+ <td align="right"><%#$this->DataItem['quantity'] %></td>
+ <td align="right">$<%#$this->DataItem['price'] %></td>
+</tr>
+<tr>
+ <td colspan="4" align="right">
+ <com:TActiveLinkButton
+ Text="Edit"
+ CommandName="edit"
+ />
+ <com:TActiveLinkButton
+ Text="Delete"
+ CommandName="delete"
+ Attributes.onclick="if(!confirm('Are you sure?')) return false;"
+ />
+ </td>
+</tr>
+</table>
+</prop:SelectedItemTemplate>
+
+<prop:EditItemTemplate>
+<table border="0" width="100%">
+<tr>
+ <td align="right">ID</td>
+ <td><b><%#$this->DataItem['id']%></b></td>
+</tr>
+<tr>
+ <td align="right">Name</td>
+ <td><com:TTextBox
+ ID="ProductName"
+ Text=<%#$this->DataItem['name'] %>
+ />
+ </td>
+</tr>
+<tr>
+ <td align="right">Quantity</td>
+ <td><com:TTextBox
+ ID="ProductQuantity"
+ Text=<%#$this->DataItem['quantity'] %>
+ />
+ </td>
+</tr>
+<tr>
+ <td align="right">Price</td>
+ <td><com:TTextBox
+ ID="ProductPrice"
+ Text=<%#$this->DataItem['price'] %>
+ />
+ </td>
+</tr>
+<tr>
+ <td align="right">Imported</td>
+ <td><com:TCheckBox
+ ID="ProductImported"
+ Checked=<%#$this->DataItem['imported'] %>
+ />
+ </td>
+</tr>
+<tr>
+ <td colspan="2" align="right">
+ <com:TActiveLinkButton Text="Save" CommandName="update" />
+ <com:TActiveLinkButton Text="Cancel" CommandName="cancel" />
+ </td>
+</tr>
+</table>
+</prop:EditItemTemplate>
+
+</com:TActiveDataList>
+
+<div class="last-modified">$Id$</div></com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.php new file mode 100644 index 00000000..c62a239d --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.php @@ -0,0 +1,132 @@ +<?php
+
+class Home extends TPage
+{
+ private $_data=null;
+
+ protected function getData()
+ {
+ if($this->_data===null)
+ $this->loadData();
+ return $this->_data;
+ }
+
+ protected function loadData()
+ {
+ // We use viewstate keep track of data.
+ // In real applications, data should come from database using an SQL SELECT statement.
+ // In the following tabular data, field 'id' is the primary key.
+ // All update and delete operations should come with an 'id' value in order to go through.
+ if(($this->_data=$this->getViewState('Data',null))===null)
+ {
+ $this->_data=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'=>false),
+ 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'=>true),
+ array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>false),
+ );
+ $this->saveData();
+ }
+ }
+
+ protected function saveData()
+ {
+ $this->setViewState('Data',$this->_data);
+ }
+
+ protected function updateProduct($id,$name,$quantity,$price,$imported)
+ {
+ // In real applications, data should be saved to database using an SQL UPDATE statement
+ if($this->_data===null)
+ $this->loadData();
+ $updateRow=null;
+ foreach($this->_data as $index=>$row)
+ if($row['id']===$id)
+ $updateRow=&$this->_data[$index];
+ if($updateRow!==null)
+ {
+ $updateRow['name']=$name;
+ $updateRow['quantity']=TPropertyValue::ensureInteger($quantity);
+ $updateRow['price']=TPropertyValue::ensureFloat($price);
+ $updateRow['imported']=TPropertyValue::ensureBoolean($imported);
+ $this->saveData();
+ }
+ }
+
+ protected function deleteProduct($id)
+ {
+ // In real applications, data should be saved to database using an SQL DELETE statement
+ if($this->_data===null)
+ $this->loadData();
+ $deleteIndex=-1;
+ foreach($this->_data as $index=>$row)
+ if($row['id']===$id)
+ $deleteIndex=$index;
+ if($deleteIndex>=0)
+ {
+ unset($this->_data[$deleteIndex]);
+ $this->saveData();
+ }
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+ }
+
+ public function editItem($sender,$param)
+ {
+ $this->DataList->SelectedItemIndex=-1;
+ $this->DataList->EditItemIndex=$param->Item->ItemIndex;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+
+ public function cancelItem($sender,$param)
+ {
+ $this->DataList->SelectedItemIndex=-1;
+ $this->DataList->EditItemIndex=-1;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+
+ public function updateItem($sender,$param)
+ {
+ $item=$param->Item;
+ $this->updateProduct(
+ $this->DataList->DataKeys[$item->ItemIndex],
+ $item->ProductName->Text,
+ $item->ProductQuantity->Text,
+ $item->ProductPrice->Text,
+ $item->ProductImported->Checked);
+ $this->DataList->EditItemIndex=-1;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+
+ public function deleteItem($sender,$param)
+ {
+ $this->deleteProduct($this->DataList->DataKeys[$param->Item->ItemIndex]);
+ $this->DataList->SelectedItemIndex=-1;
+ $this->DataList->EditItemIndex=-1;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+
+ public function selectItem($sender,$param)
+ {
+ $this->DataList->EditItemIndex=-1;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+}
+
+?>
\ No newline at end of file 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 diff --git a/demos/quickstart/protected/pages/Controls/DataGrid.page b/demos/quickstart/protected/pages/Controls/DataGrid.page index bc700449..85a53011 100644 --- a/demos/quickstart/protected/pages/Controls/DataGrid.page +++ b/demos/quickstart/protected/pages/Controls/DataGrid.page @@ -1,6 +1,7 @@ <com:TContent ID="body" >
<h1 id="5201">TDataGrid</h1>
+<com:DocLink ClassPath="System.Web.UI.WebControls.TDataGrid" />
<p id="590373" class="block-content">
TDatagrid is an important control in building complex Web applications. It displays data in a tabular format with rows (also called items) and columns. A row is composed by cells, while columns govern how cells should be displayed according to their association with the columns. Data specified via <tt>DataSource</tt> or <tt>DataSourceID</tt> are bound to the rows and feed contents to cells.
@@ -17,7 +18,7 @@ Rows of TDataGrid can be accessed via its <tt>Items</tt> property. A row (item) Columns of a data grid determine how the associated cells are displayed. For example, cells associated with a <tt>TBoundColumn</tt> are displayed differently according to their modes. A cell is displayed as a static text if the cell is in browsing mode, a text box if it is in editing mode, and so on.
</p>
<p id="590377" class="block-content">
-PRADO provides five types of columns:
+PRADO provides eight types of columns:
</p>
<ul id="u1" class="block-content">
<li><tt>TBoundColumn</tt> associates cells with a specific field of data and displays the cells according to their modes.</li>
diff --git a/demos/quickstart/protected/pages/Controls/DataList.page b/demos/quickstart/protected/pages/Controls/DataList.page index d92aa69c..14197f35 100644 --- a/demos/quickstart/protected/pages/Controls/DataList.page +++ b/demos/quickstart/protected/pages/Controls/DataList.page @@ -1,6 +1,8 @@ <com:TContent ID="body" >
<h1 id="5101">TDataList</h1>
+<com:DocLink ClassPath="System.Web.UI.WebControls.TDataList" />
+
<p id="580362" class="block-content">
TDataList represents a data bound and updatable list control. Like <tt>TRepeater</tt>, TDataList displays its content repeatedly based on the data fetched from <tt>DataSource</tt>. The repeated contents in TDataList are called items, which are controls and can be accessed through <tt>Items</tt>. When <tt>dataBind()</tt> is invoked, TDataList creates an item for each row of data and binds the data row to the item. Optionally, a TDataList can have a header, a footer and/or separators between items.
</p>
diff --git a/demos/quickstart/protected/pages/Controls/Repeater.page b/demos/quickstart/protected/pages/Controls/Repeater.page index 1e2ac881..459f8767 100644 --- a/demos/quickstart/protected/pages/Controls/Repeater.page +++ b/demos/quickstart/protected/pages/Controls/Repeater.page @@ -1,6 +1,7 @@ <com:TContent ID="body" >
<h1 id="5301">TRepeater</h1>
+<com:DocLink ClassPath="System.Web.UI.WebControls.TRepeater" />
<p id="600400" class="block-content">
TRepeater displays its content repeatedly based on the data fetched from <tt>DataSource</tt>. The repeated contents in TRepeater are called <i>items</i> which are controls accessible through <tt>Items</tt> property. When <tt>dataBind()</tt> is invoked, TRepeater creates an item for each row of data and binds the data row to the item. Optionally, a repeater can have a header, a footer and/or separators between items.
|