diff options
author | xue <> | 2006-08-27 14:45:57 +0000 |
---|---|---|
committer | xue <> | 2006-08-27 14:45:57 +0000 |
commit | 304427074ddf629fd2708b23a3fe0cd0122c05a8 (patch) | |
tree | 49e86b72451444cb632d38b82ab4e6399ff156ec /demos/quickstart/protected/pages/Controls/Samples/TDataGrid | |
parent | 17f7daf67672f2d2252d9199451fe873d61c2c7a (diff) |
Cells in TDataGrid rows can now be accessed via the corresponding column IDs.
Input controls in some datagrid columns can now be accessed in a named fashion.
Diffstat (limited to 'demos/quickstart/protected/pages/Controls/Samples/TDataGrid')
-rw-r--r-- | demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page | 7 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php | 16 |
2 files changed, 14 insertions, 9 deletions
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page index 2864de46..96affa4a 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page +++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page @@ -23,16 +23,19 @@ >
<com:TBoundColumn
+ ID="BookTitleColumn"
HeaderText="Book Title"
HeaderStyle.Width="400px"
DataField="title"
/>
<com:TBoundColumn
+ ID="PublisherColumn"
HeaderText="Publisher"
HeaderStyle.Width="150px"
DataField="publisher"
/>
<com:TBoundColumn
+ ID="PriceColumn"
ItemStyle.HorizontalAlign="Right"
ItemStyle.Wrap="false"
ItemStyle.Font.Italic="false"
@@ -43,10 +46,11 @@ DataFormatString="$%.2f"
/>
<com:TCheckBoxColumn
+ ID="InStockColumn"
HeaderText="In-stock"
DataField="instock"
/>
- <com:TTemplateColumn HeaderText="Rating">
+ <com:TTemplateColumn ID="RatingColumn" HeaderText="Rating">
<prop:ItemTemplate>
<img src="images/star<%#$this->Parent->DataItem['rating']%>.gif" alt="" />
</prop:ItemTemplate>
@@ -70,6 +74,7 @@ ItemStyle.Font.Italic="false"
/>
<com:TButtonColumn
+ ID="DeleteColumn"
HeaderText="Delete"
HeaderStyle.Width="50px"
ItemStyle.HorizontalAlign="Center"
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php index 6d8c0085..69a164c6 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php @@ -138,13 +138,13 @@ class Sample3 extends TPage if($item->ItemType==='EditItem')
{
// set column width of textboxes
- $item->Cells[0]->Controls[0]->Columns=40;
- $item->Cells[2]->Controls[0]->Columns=5;
+ $item->BookTitleColumn->TextBox->Columns=40;
+ $item->PriceColumn->TextBox->Columns=5;
}
if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem' || $item->ItemType==='EditItem')
{
// add an aleart dialog to delete buttons
- $item->Cells[6]->Controls[0]->Attributes->onclick='if(!confirm(\'Are you sure?\')) return false;';
+ $item->DeleteColumn->Button->Attributes->onclick='if(!confirm(\'Are you sure?\')) return false;';
}
}
@@ -160,11 +160,11 @@ class Sample3 extends TPage $item=$param->Item;
$this->updateBook(
$this->DataGrid->DataKeys[$item->ItemIndex], // ISBN
- $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[4]->Rating->SelectedValue // rating
+ $item->BookTitleColumn->TextBox->Text, // title
+ $item->PublisherColumn->TextBox->Text, // publisher
+ $item->PriceColumn->TextBox->Text, // price
+ $item->InStockColumn->CheckBox->Checked, // instock
+ $item->RatingColumn->Rating->SelectedValue // rating
);
$this->DataGrid->EditItemIndex=-1;
$this->DataGrid->DataSource=$this->Data;
|