diff options
Diffstat (limited to 'demos/quickstart/protected/pages/Controls')
3 files changed, 16 insertions, 18 deletions
diff --git a/demos/quickstart/protected/pages/Controls/DataGrid.page b/demos/quickstart/protected/pages/Controls/DataGrid.page index 392b78ab..2a51a3de 100644 --- a/demos/quickstart/protected/pages/Controls/DataGrid.page +++ b/demos/quickstart/protected/pages/Controls/DataGrid.page @@ -22,6 +22,7 @@ PRADO provides five types of columns: <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>TDropDownListColumn</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>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.</li>
@@ -114,7 +115,8 @@ The following example uses manually specified columns to show a list of book inf Besides the rich data presentation functionalities as demonstrated in previous section, TDataGrid is also highly user interactive. An import usage of TDataGrid is editing or deleting rows of data. The <tt>TBoundColumn</tt> can adjust the associated cell presentation according to the mode of datagrid items. When an item is in browsing mode, the cell is displayed with a static text; when the item is in editing mode, a textbox is displayed to collect user inputs. TDataGrid provides <tt>TEditCommandColumn</tt> for switching item modes. In addition, <tt>TButtonColumn</tt> offers developers the flexibility of creating arbitrary buttons for various user interactions.
</p>
<p>
-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>TEditCommandColumn</tt> and <tt>TButtonColumn</tt>.
+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>TEditCommandColumn</tt> and <tt>TButtonColumn</tt>. In addition,
+<tt>TDropDownListColumn</tt> replaces the previous <tt>TTemplateColumn</tt> to allow users to select a rating from a dropdown list. Note, it is also possible to use <tt>TTemplateColumn</tt> to achieve the same task.
</p>
<com:RunBar PagePath="Controls.Samples.TDataGrid.Sample3" />
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page index 96affa4a..5fb19c6f 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page +++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page @@ -50,22 +50,18 @@ HeaderText="In-stock"
DataField="instock"
/>
- <com:TTemplateColumn ID="RatingColumn" HeaderText="Rating">
- <prop:ItemTemplate>
- <img src="images/star<%#$this->Parent->DataItem['rating']%>.gif" alt="" />
- </prop:ItemTemplate>
- <prop:EditItemTemplate>
- <com:TDropDownList
- SelectedValue=<%#$this->Parent->DataItem['rating'] %>
- ID="Rating">
- <com:TListItem Value="1" />
- <com:TListItem Value="2" />
- <com:TListItem Value="3" />
- <com:TListItem Value="4" />
- <com:TListItem Value="5" />
- </com:TDropDownList>
- </prop:EditItemTemplate>
- </com:TTemplateColumn>
+ <com:TDropDownListColumn
+ ID="RatingColumn"
+ HeaderText="Rating"
+ DataField="rating"
+ >
+ <prop:DataFormatString><img src="images/star%s.gif" alt="" /></prop:DataFormatString>
+ <com:TListItem Value="1" />
+ <com:TListItem Value="2" />
+ <com:TListItem Value="3" />
+ <com:TListItem Value="4" />
+ <com:TListItem Value="5" />
+ </com:TDropDownListColumn>
<com:TEditCommandColumn
HeaderText="Edit"
HeaderStyle.Width="100px"
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php index 69a164c6..bb18f36b 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php @@ -164,7 +164,7 @@ class Sample3 extends TPage $item->PublisherColumn->TextBox->Text, // publisher
$item->PriceColumn->TextBox->Text, // price
$item->InStockColumn->CheckBox->Checked, // instock
- $item->RatingColumn->Rating->SelectedValue // rating
+ $item->RatingColumn->DropDownList->SelectedValue // rating
);
$this->DataGrid->EditItemIndex=-1;
$this->DataGrid->DataSource=$this->Data;
|