summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Controls/Samples
diff options
context:
space:
mode:
authorxue <>2006-02-04 23:56:29 +0000
committerxue <>2006-02-04 23:56:29 +0000
commit139ca38ddcf4998c882cfc98cb932524de210d86 (patch)
tree99471fff9e2db46d01e5473cfd5c1566c7c1209a /demos/quickstart/protected/pages/Controls/Samples
parent97d5ad831a6003418562b7f44e9a08e562d88a0c (diff)
Modified TDataGrid sample to enable updating rating.
Diffstat (limited to 'demos/quickstart/protected/pages/Controls/Samples')
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page17
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php8
2 files changed, 22 insertions, 3 deletions
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page
index 82253c30..6d3397ee 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page
@@ -46,6 +46,23 @@
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>
+ <prop:EditItemTemplate>
+ <com:TDropDownList
+ SelectedValue=<%#$this->NamingContainer->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: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 89adcc37..6d8c0085 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php
@@ -86,7 +86,7 @@ class Sample3 extends TPage
$this->setViewState('Data',$this->_data);
}
- protected function updateBook($isbn,$title,$publisher,$price,$instock)
+ protected function updateBook($isbn,$title,$publisher,$price,$instock,$rating)
{
// In real applications, data should be saved to database using an SQL UPDATE statement
if($this->_data===null)
@@ -101,6 +101,7 @@ class Sample3 extends TPage
$updateRow['publisher']=$publisher;
$updateRow['price']=TPropertyValue::ensureFloat(ltrim($price,'$'));
$updateRow['instock']=TPropertyValue::ensureBoolean($instock);
+ $updateRow['rating']=TPropertyValue::ensureInteger($rating);
$this->saveData();
}
}
@@ -143,7 +144,7 @@ class Sample3 extends TPage
if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem' || $item->ItemType==='EditItem')
{
// add an aleart dialog to delete buttons
- $item->Cells[5]->Controls[0]->Attributes->onclick='if(!confirm(\'Are you sure?\')) return false;';
+ $item->Cells[6]->Controls[0]->Attributes->onclick='if(!confirm(\'Are you sure?\')) return false;';
}
}
@@ -162,7 +163,8 @@ class Sample3 extends TPage
$item->Cells[0]->Controls[0]->Text, // title
$item->Cells[1]->Controls[0]->Text, // publisher
$item->Cells[2]->Controls[0]->Text, // price
- $item->Cells[3]->Controls[0]->Checked // instock
+ $item->Cells[3]->Controls[0]->Checked, // instock
+ $item->Cells[4]->Rating->SelectedValue // rating
);
$this->DataGrid->EditItemIndex=-1;
$this->DataGrid->DataSource=$this->Data;