diff options
Diffstat (limited to 'demos')
-rw-r--r-- | demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page | 17 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php | 8 |
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;
|