summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Database
diff options
context:
space:
mode:
authorwei <>2007-03-21 03:27:12 +0000
committerwei <>2007-03-21 03:27:12 +0000
commit5885bd12735637430e093c896499c3f26832fceb (patch)
tree53387f902c060685b5f466b042aa234baa301da6 /demos/quickstart/protected/pages/Database
parent4b41982314af49396ee577c8d4dea0624b8e9096 (diff)
minor AR updates, remove obsolete TApplication::$_pageService
Diffstat (limited to 'demos/quickstart/protected/pages/Database')
-rw-r--r--demos/quickstart/protected/pages/Database/Scaffold.page80
1 files changed, 66 insertions, 14 deletions
diff --git a/demos/quickstart/protected/pages/Database/Scaffold.page b/demos/quickstart/protected/pages/Database/Scaffold.page
index 055cac26..b2d52b6d 100644
--- a/demos/quickstart/protected/pages/Database/Scaffold.page
+++ b/demos/quickstart/protected/pages/Database/Scaffold.page
@@ -17,6 +17,7 @@ the following builtin functionality:
<ul>
<li>Listing of all active record items.</li>
+ <li>Searching records.</li>
<li>Paging and sorting.</li>
<li>Deleting an item.</li>
<li>Inserting a new item.</li>
@@ -39,7 +40,7 @@ table as defined in the <a href="?page=Database.ActiveRecord">Active Record</a>
<com:TTextHighlighter Language="php" CssClass="source">
class UserRecord extends TActiveRecord
{
- const TABLE='users';
+ const TABLE='users';
public $username;
public $email;
@@ -51,9 +52,9 @@ class UserRecord extends TActiveRecord
This <a href="?page=Fundamentals.Components#704">namespace</a> can be "imported" in the
<a href="?page=Configurations.AppConfig">Application Configuration</a>
using the <tt>application.xml</tt> file or through the php code using the <tt>Prado::using()</tt>
-method. The simplest way to provide CRUD functional is to use the
+method. To start using the
<com:DocLink ClassPath="System.Data.ActiveRecord.Scaffold.TScaffoldView" Text="TScaffoldView"/>
-where the <tt>RecordClass</tt> property value equals to an Active Record
+simply set the <tt>RecordClass</tt> property value equal to an Active Record
class name.
</p>
@@ -61,27 +62,83 @@ class name.
&lt;com:TScaffoldView RecordClass="UserRecord" /&gt;
</com:TTextHighlighter>
-<h2>Todo...</h2>
+<p>The above code will list the current records in the <tt>users</tt> table.
+Each record can be edited by clicking on the "edit" button and deleted by
+clicking on the "delete" button. A new record can be added by clicking on the
+"Add new record" button, enter some data (notice the automatic validation of required fields and data types), and click the "save" button.
+Specifying search terms in the search textbox to find particular records. Finally, the
+record list can be sorted for each column by changing the sorting column and order.
+</p>
+
+<p>The <tt>TScaffoldView</tt> is a template control composed of other scaffold controls.
+The following properties gives access to these composite controls.</p>
+<ul>
+ <li><b><tt>ListView</tt></b> -- the <tt>TScaffoldListView</tt> displaying the record list. </li>
+ <li><b><tt>EditView</tt></b> -- the <tt>TScaffoldEditView</tt> that renders the inputs for editing and adding records.</li>
+ <li><b><tt>SearchControl</tt></b> -- the <tt>TScaffoldSearch</tt> responsible to the search user interface.</li>
+</ul>
+<p>
+ All these composite controls can be customized as we shall see below.
+</p>
+
+<h2>TScaffoldListView</h2>
+
+<p>A list of Active Records can be displayed using the <tt>TScaffoldListView</tt>
+with the following useful properties.</p>
+<ul>
+ <li><b><tt>Header</tt></b> -- a <a href="?page=Controls.Repeater">TRepeater</a>
+displaying the Active Record property/field names. </li>
+ <li><b><tt>Sort</tt></b> -- a <a href="?page=Controls.List">TDropDownList</a> displaying the combination
+of properties and its possible ordering. </li>
+ <li><b><tt>Pager</tt></b> -- a <a href="?page=Controls.Pager">TPager</a> control displaying
+the links and/or buttons that navigate to different pages in the Active Record data.</li>
+ <li><b><tt>List</tt></b> -- a <a href="?page=Controls.Repeater">TRepeater</a> that renders a row of Active Record data.</li>
+</ul>
-<p>Other views... list view</p>
+<p>Custom rendering of the each Active Record can be achieved by specifying
+the <tt>ItemTemplate</tt> and/or <tt>AlternatingItemTemplate</tt> property of the <tt>List</tt>
+repeater.
+The <tt>TScaffoldListView</tt> will listen for two command events named "delete" and
+"edit". A "delete" command will delete a the record for the row where the "delete" command originates.
+An "edit" command will push the record data to be edited by a
+<tt>TScaffoldEditView</tt> with ID specified by the <tt>EditViewID</tt> property.
+The following example lists the usernames only with bold formatting.
+</p>
<com:TTextHighlighter Language="prado" CssClass="source">
-&lt;com:TScaffoldListView RecordClass="UserRecord" /&gt;
+&lt;com:TScaffoldListView RecordClass="UserRecord" &gt;
+ &lt;prop:List.ItemTemplate&gt;
+ &lt;strong>&lt;%# $this->Data->username %>&lt;/strong&gt;
+ &lt;/prop:List.ItemTemplate&gt;
+&lt;/com:TScaffoldListView&gt;
</com:TTextHighlighter>
-<p>edit view...</p>
+<div class="info"><b class="note">Info:</b>
+For the <tt>TScaffoldView</tt> the list view can be accessed throught the <tt>ListView</tt> property of a <tt>TScaffoldView</tt>.
+Thus, the subproperty <tt>ListView.List.ItemTemplate</tt> on <tt>TScaffoldView</tt>
+is equivalent to the <tt>List.ItemTemplate</tt> subproperty of <tt>TScaffoldListView</tt> in the above example.
+</div>
+
+<p>The <tt>SearchCondition</tt> property and
+<tt>SearchParameters</tt> property (takes array values) can be
+specified to customize the records to be shown. The <tt>SearchCondition</tt>
+will be used as the <tt>Condition</tt> property of <tt>TActiveRecordCriteria</tt>
+and the <tt>SearchParameters</tt> property corresponds to
+<tt>Parameters</tt> property of <tt>TActiveRecordCriteria</tt>.</p>
+
+<h2>TScaffoldEditView</h2>
<com:TTextHighlighter Language="prado" CssClass="source">
&lt;com:TScaffoldEditView RecordPk="user1" RecordClass="UserRecord" /&gt;
</com:TTextHighlighter>
-<p>Combining list + edit views</p>
+<h2>Combining list + edit views</h2>
<com:TTextHighlighter Language="prado" CssClass="source">
&lt;com:TScaffoldEditView ID="edit_view" RecordClass="UserRecord" /&gt;
&lt;com:TScaffoldListView EditViewID="edit_view" RecordClass="UserRecord" /&gt;
</com:TTextHighlighter>
-<p>custom list view...</p>
+<h2>Customizing the TScaffoldView</h2>
<com:TTextHighlighter Language="prado" CssClass="source">
&lt;com:TScaffoldView RecordClass="UserRecord" &gt;
&lt;prop:ListView.List.ItemTemplate&gt;
@@ -90,10 +147,5 @@ class name.
&lt;/prop:ListView.List.ItemTemplate&gt;
&lt;/com:TScaffoldView/&gt;
</com:TTextHighlighter>
-<p>To be completed...</p>
-
-<p>Address book example...</p>
-
-<com:RunBar PagePath="Database.Samples.Scaffold.Home" />
<div class="last-modified">$Id$</div></com:TContent> \ No newline at end of file