From eab6bb13b9efb3e1c6d725368368de4d74b00946 Mon Sep 17 00:00:00 2001 From: wei <> Date: Mon, 7 May 2007 04:17:37 +0000 Subject: Update Active Record docs. --- .../protected/pages/Database/Scaffold.page | 46 +++++++++++----------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'demos/quickstart/protected/pages/Database/Scaffold.page') diff --git a/demos/quickstart/protected/pages/Database/Scaffold.page b/demos/quickstart/protected/pages/Database/Scaffold.page index 9afe4a3f..759e55d1 100644 --- a/demos/quickstart/protected/pages/Database/Scaffold.page +++ b/demos/quickstart/protected/pages/Database/Scaffold.page @@ -1,8 +1,8 @@ -

Active Record Scaffold Views

+

Active Record Scaffold Views

-

Active Record classes can be used together with +

Active Record classes can be used together with and @@ -10,7 +10,7 @@ and links both TScaffoldListView and TScaffoldEditView) to create simple Create/Read/Update/Delete (CRUD) web applications.

-

The scaffold views are intended to assist in prototyping web application, +

The scaffold views are intended to assist in prototyping web application, they are not designed to be as customiziable as more complex components such as TDataGrid. The scaffold views provide the following builtin functionality: @@ -27,18 +27,18 @@ the following builtin functionality:

  • Presents specialized controls such as date pickers.
  • -

    Scaffold views are dependent on Active Records and currently supports +

    Scaffold views are dependent on Active Records and currently supports the following databases: Mysql, Sqlite and Postgres SQL. Support for other databases can be considered when there are sufficient demand.

    -

    Setting up a Scaffold View

    -

    To use the scaffold view, we first define an Active Record +

    Setting up a Scaffold View

    +

    To use the scaffold view, we first define an Active Record class that represents a table or view in the database. Consider the following Active Record class that corresponds to the users table as defined in the Active Record quickstart page.

    - + class UserRecord extends TActiveRecord { const TABLE='users'; @@ -48,7 +48,7 @@ class UserRecord extends TActiveRecord } -

    The scaffold view classes are in the System.Data.ActiveRecord.Scaffold.* +

    The scaffold view classes are in the System.Data.ActiveRecord.Scaffold.* namespace. This namespace can be "imported" in the Application Configuration @@ -59,11 +59,11 @@ simply set the RecordClass property value equal to an Active Record class name.

    - + <com:TScaffoldView RecordClass="UserRecord" /> -

    The above code will list the current records in the users table. +

    The above code will list the current records in the users 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. @@ -71,20 +71,20 @@ Specifying search terms in the search textbox to find particular records. Finall record list can be sorted for each column by changing the sorting column and order.

    -

    The TScaffoldView is a template control composed of other scaffold controls. +

    The TScaffoldView is a template control composed of other scaffold controls. The following properties gives access to these composite controls.

    • ListView -- the TScaffoldListView displaying the record list.
    • EditView -- the TScaffoldEditView that renders the inputs for editing and adding records.
    • SearchControl -- the TScaffoldSearch responsible to the search user interface.
    -

    +

    All these composite controls can be customized as we shall see below.

    -

    TScaffoldListView

    +

    TScaffoldListView

    -

    A list of Active Records can be displayed using the TScaffoldListView +

    A list of Active Records can be displayed using the TScaffoldListView with the following useful properties.

    • Header -- a TRepeater @@ -96,7 +96,7 @@ the links and/or buttons that navigate to different pages in the Active Record d
    • List -- a TRepeater that renders a row of Active Record data.
    -

    Custom rendering of the each Active Record can be achieved by specifying +

    Custom rendering of the each Active Record can be achieved by specifying the ItemTemplate and/or AlternatingItemTemplate property of the List repeater. The TScaffoldListView will listen for two command events named "delete" and @@ -106,7 +106,7 @@ An "edit" command will push the record data to be edited by a The following example lists the usernames only with bold formatting.

    - + <com:TScaffoldListView RecordClass="UserRecord" > <prop:List.ItemTemplate> <strong><%# $this->Data->username %></strong> @@ -120,27 +120,27 @@ Thus, the subproperty ListView.List.ItemTemplate on TScaffoldViewList.ItemTemplate subproperty of TScaffoldListView in the above example. -

    The SearchCondition property and +

    The SearchCondition property and SearchParameters property (takes array values) can be specified to customize the records to be shown. The SearchCondition will be used as the Condition property of TActiveRecordCriteria and the SearchParameters property corresponds to Parameters property of TActiveRecordCriteria.

    -

    TScaffoldEditView

    - +

    TScaffoldEditView

    + <com:TScaffoldEditView RecordPk="user1" RecordClass="UserRecord" /> -

    Combining list + edit views

    +

    Combining list + edit views

    - + <com:TScaffoldEditView ID="edit_view" RecordClass="UserRecord" /> <com:TScaffoldListView EditViewID="edit_view" RecordClass="UserRecord" /> -

    Customizing the TScaffoldView

    - +

    Customizing the TScaffoldView

    + <com:TScaffoldView RecordClass="UserRecord" > <prop:ListView.List.ItemTemplate> <%# $this->DataItem->username %> -- cgit v1.2.3