Active Record Scaffold Views

Active Record classes can be used together with 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, they are not designed to be as customiziable as more complex components such as TDataGrid. The scaffold views provide the following builtin functionality:

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 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'; public $username; public $email; }

The scaffold view classes are in the System.Data.ActiveRecord.Scaffold.* namespace. This namespace can be "imported" in the Application Configuration using the application.xml file or through the php code using the Prado::using() method. The simplest way to provide CRUD functional is to use the where the RecordClass property value equals to an Active Record class name.

<com:TScaffoldView RecordClass="UserRecord" />

Todo...

Other views... list view

<com:TScaffoldListView RecordClass="UserRecord" />

edit view...

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

Combining list + edit views

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

custom list view...

<com:TScaffoldView RecordClass="UserRecord" > <prop:ListView.List.ItemTemplate> <%# $this->DataItem->username %> <com:TLinkButton Text="Edit" CommandName="edit" /> </prop:ListView.List.ItemTemplate> </com:TScaffoldView/>

To be completed...

Address book example...

$Id$