From 139ca38ddcf4998c882cfc98cb932524de210d86 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 4 Feb 2006 23:56:29 +0000 Subject: Modified TDataGrid sample to enable updating rating. --- .../pages/Controls/Samples/TDataGrid/Sample3.page | 17 +++++++++++++++++ .../pages/Controls/Samples/TDataGrid/Sample3.php | 8 +++++--- 2 files changed, 22 insertions(+), 3 deletions(-) (limited to 'demos/quickstart/protected/pages') 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" /> + + Rating + + + + + NamingContainer->DataItem['rating'] %> + ID="Rating"> + + + + + + + + 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; -- cgit v1.2.3