summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected
diff options
context:
space:
mode:
Diffstat (limited to 'demos/quickstart/protected')
-rw-r--r--demos/quickstart/protected/pages/Controls/DataGrid.page9
-rw-r--r--demos/quickstart/protected/pages/Controls/DataGrid1.page18
-rw-r--r--demos/quickstart/protected/pages/Controls/Overview.page2
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.page40
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php75
5 files changed, 104 insertions, 40 deletions
diff --git a/demos/quickstart/protected/pages/Controls/DataGrid.page b/demos/quickstart/protected/pages/Controls/DataGrid.page
deleted file mode 100644
index 9170fe45..00000000
--- a/demos/quickstart/protected/pages/Controls/DataGrid.page
+++ /dev/null
@@ -1,9 +0,0 @@
-<com:TContent ID="body" >
-
-<h1>TDataGrid</h1>
-<p>
-TBC
-</p>
-<com:RunBar PagePath="Controls.Samples.TDataGrid.Sample1" />
-
-</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/DataGrid1.page b/demos/quickstart/protected/pages/Controls/DataGrid1.page
index 27e5a777..b7d6fe8f 100644
--- a/demos/quickstart/protected/pages/Controls/DataGrid1.page
+++ b/demos/quickstart/protected/pages/Controls/DataGrid1.page
@@ -21,6 +21,7 @@ PRADO provides five types of columns:
</p>
<ul>
<li><tt>TBoundColumn</tt> associates cells with a specific field of data and displays the cells according to their modes.</li>
+ <li><tt>TCheckBoxColumn</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>THyperLinkColumn</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>TEditCommandColumn</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>TButtonColumn</tt> displays in the cells a command button.
@@ -63,7 +64,7 @@ TDataGrid provides several events to facilitate manipulation of its items,
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>TBoundColumn</tt>.
</p>
<p>
-The following example displays a list of computer product information using a TDataGrid. Columns are automatically generated. To populate datagrid items with the data, <tt>dataBind()</tt> is invoked for the datagrid in the <tt>onLoad</tt> method of the page,
+The following example displays a list of computer product information using a TDataGrid. Columns are automatically generated. Pay attention to how item styles are specified and inherited. The data are populated into the datagrid using the follow code, which is common among most datagrid applications,
</p>
<com:TTextHighlighter Language="php" CssClass="source">
public function onLoad($param) {
@@ -78,7 +79,7 @@ public function onLoad($param) {
<h3>Manually Specified Columns</h3>
<p>
-Using automatically generated columns gives a quick way of browsing tabular data. In real applications, however, automatically generated columns are often not enough because developers have no way configuring their properties. Manually specified columns are thus more desirable.
+Using automatically generated columns gives a quick way of browsing tabular data. In real applications, however, automatically generated columns are often not sufficient because developers have no way customizing their appearance. Manually specified columns are thus more desirable.
</p>
<p>
To manually specify columns, set <tt>AutoGenerateColumns</tt> to false, and specify the columns in a template like the following,
@@ -92,8 +93,19 @@ To manually specify columns, set <tt>AutoGenerateColumns</tt> to false, and spec
&lt;/com:TDataGrid&gt;
</com:TTextHighlighter>
<p>
-Note, if <tt>AutoGenerateColumns</tt> is true and there are manually specified columns, the automatically generated columns will be appended to the manually specified columns. Also note, the datagrid's <tt>Columns</tt> property only contains manually specified columns.
+Note, if <tt>AutoGenerateColumns</tt> is true and there are manually specified columns, the automatically generated columns will be appended to the manually specified columns. Also note, the datagrid's <tt>Columns</tt> property contains only manually specified columns and no automatically generated ones.
</p>
+<p>
+The following example uses manually specified columns to show a list of book information,
+</p>
+<ul>
+ <li>Book title - displayed a hyperlink pointing to the corresponding amazon.com book page. <tt>THyperLinkColumn</tt> is used.</li>
+ <li>Publisher - displayed as a piece of text using <tt>TBoundColumn</tt>.</li>
+ <li>Price - displayed as a piece of text using <tt>TBoundColumn</tt> with output formatting string and customized styles.</li>
+ <li>In-stock or not - displayed as a checkbox using <tt>TCheckBoxColumn</tt>.</li>
+ <li>Rating - displayed as an image using <tt>TTemplateColumn</tt> which allows maximum freedom in specifiying cell contents.</li>
+</ul>
+<p>Pay attention to how item (row) styles and column styles cooperate together to affect the appearance of the cells in the datagrid.</p>
<com:RunBar PagePath="Controls.Samples.TDataGrid.Sample2" />
</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Overview.page b/demos/quickstart/protected/pages/Controls/Overview.page
index 03b4a2a2..ec3ac5be 100644
--- a/demos/quickstart/protected/pages/Controls/Overview.page
+++ b/demos/quickstart/protected/pages/Controls/Overview.page
@@ -4,6 +4,6 @@
Control are components defined in addition with user interface. Control classes constitute a major part of the PRADO framework. Nearly every generic HTML element can find its representation in terms of a PRADO control. Mastering these controls becomes extremely important for developers to compose effectively and efficiently applications using PRADO.
</p>
<p>
-To be continued...
+TBW: Control ID, Parent, NamingContainer, ViewState, ControlState, TWebControl, DataBound Control, ActiveControls
</p>
</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.page b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.page
index c810708d..1a38c90d 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.page
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.page
@@ -4,22 +4,46 @@
<h2>Using Manually Specified Columns</h2>
<com:TDataGrid
+ Width="700px"
ID="DataGrid"
AutoGenerateColumns="false"
EnableViewState="false"
- HeaderStyle.BackColor="silver"
- ItemStyle.BackColor="lightblue"
+ HeaderStyle.BackColor="black"
+ HeaderStyle.ForeColor="white"
+ ItemStyle.BackColor="#BFCFFF"
ItemStyle.Font.Italic="true"
- AlternatingItemStyle.BackColor="lightgreen">
+ AlternatingItemStyle.BackColor="#E6ECFF">
+ <com:THyperLinkColumn
+ HeaderText="Book Title"
+ DataTextField="title"
+ DataNavigateUrlField="ISBN"
+ DataNavigateUrlFormatString="http://www.amazon.com/gp/product/%s"
+ Target="_blank"
+ />
+ <com:TBoundColumn
+ HeaderText="Publisher"
+ DataField="publisher"
+ />
<com:TBoundColumn
- ItemStyle.BackColor="silver"
- HeaderText="Name"
- DataField="name"
+ ItemStyle.HorizontalAlign="Right"
+ ItemStyle.Wrap="false"
+ ItemStyle.Font.Italic="false"
+ ItemStyle.ForeColor="green"
+ HeaderText="Price"
+ DataField="price"
+ DataFormatString="$%.2f"
/>
<com:TCheckBoxColumn
- HeaderText="Imported"
- DataField="imported" />
+ HeaderText="In-stock"
+ DataField="instock"
+ />
+ <com:TTemplateColumn>
+ <prop:HeaderTemplate>Rating</prop:HeaderTemplate>
+ <prop:ItemTemplate>
+ <img src="images/star<%#$this->NamingContainer->DataItem['rating']%>.gif" alt="" />
+ </prop:ItemTemplate>
+ </com:TTemplateColumn>
</com:TDataGrid>
</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php
index 3d0bdf2d..16a32c28 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php
@@ -5,25 +5,62 @@ class Sample2 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),
+ array(
+ 'ISBN'=>'0596007124',
+ 'title'=>'Head First Design Patterns',
+ 'publisher'=>'O\'Reilly Media, Inc.',
+ 'price'=>29.67,
+ 'instock'=>true,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0201633612',
+ 'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>47.04,
+ 'instock'=>true,
+ 'rating'=>5,
+ ),
+ array(
+ 'ISBN'=>'0321247140',
+ 'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>37.49,
+ 'instock'=>true,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0201485672',
+ 'title'=>'Refactoring: Improving the Design of Existing Code',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>47.14,
+ 'instock'=>true,
+ 'rating'=>3,
+ ),
+ array(
+ 'ISBN'=>'0321213351',
+ 'title'=>'Refactoring to Patterns',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>38.49,
+ 'instock'=>true,
+ 'rating'=>2,
+ ),
+ array(
+ 'ISBN'=>'0735619670',
+ 'title'=>'Code Complete',
+ 'publisher'=>'Microsoft Press',
+ 'price'=>32.99,
+ 'instock'=>false,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0321278658 ',
+ 'title'=>'Extreme Programming Explained : Embrace Change',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>34.99,
+ 'instock'=>true,
+ 'rating'=>3,
+ ),
);
}