summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Controls/Samples/TDataGrid
diff options
context:
space:
mode:
Diffstat (limited to 'demos/quickstart/protected/pages/Controls/Samples/TDataGrid')
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample1.php80
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php170
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php378
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php40
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php134
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample6.php110
6 files changed, 456 insertions, 456 deletions
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample1.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample1.php
index ec78006b..628d0740 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample1.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample1.php
@@ -1,41 +1,41 @@
-<?php
-
-class Sample1 extends TPage
-{
- protected function getData()
- {
- return array(
- array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
- array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
- array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>true),
- array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
- array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
- array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>false),
- array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>true),
- array('id'=>'ITN008','name'=>'CDRW drive','quantity'=>1,'price'=>40.00,'imported'=>true),
- array('id'=>'ITN009','name'=>'Cooling fan','quantity'=>2,'price'=>10.00,'imported'=>false),
- array('id'=>'ITN010','name'=>'Video camera','quantity'=>20,'price'=>30.00,'imported'=>true),
- array('id'=>'ITN011','name'=>'Card reader','quantity'=>10,'price'=>24.00,'imported'=>true),
- array('id'=>'ITN012','name'=>'Floppy drive','quantity'=>50,'price'=>12.00,'imported'=>false),
- array('id'=>'ITN013','name'=>'CD drive','quantity'=>25,'price'=>20.00,'imported'=>true),
- array('id'=>'ITN014','name'=>'DVD drive','quantity'=>15,'price'=>80.00,'imported'=>true),
- array('id'=>'ITN015','name'=>'Mouse pad','quantity'=>50,'price'=>5.00,'imported'=>false),
- array('id'=>'ITN016','name'=>'Network cable','quantity'=>40,'price'=>8.00,'imported'=>true),
- array('id'=>'ITN017','name'=>'Case','quantity'=>8,'price'=>65.00,'imported'=>false),
- array('id'=>'ITN018','name'=>'Surge protector','quantity'=>45,'price'=>15.00,'imported'=>false),
- array('id'=>'ITN019','name'=>'Speaker','quantity'=>35,'price'=>65.00,'imported'=>false),
- );
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
- }
-}
-
+<?php
+
+class Sample1 extends TPage
+{
+ protected function getData()
+ {
+ return array(
+ array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
+ array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>true),
+ array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
+ array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>false),
+ array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>true),
+ array('id'=>'ITN008','name'=>'CDRW drive','quantity'=>1,'price'=>40.00,'imported'=>true),
+ array('id'=>'ITN009','name'=>'Cooling fan','quantity'=>2,'price'=>10.00,'imported'=>false),
+ array('id'=>'ITN010','name'=>'Video camera','quantity'=>20,'price'=>30.00,'imported'=>true),
+ array('id'=>'ITN011','name'=>'Card reader','quantity'=>10,'price'=>24.00,'imported'=>true),
+ array('id'=>'ITN012','name'=>'Floppy drive','quantity'=>50,'price'=>12.00,'imported'=>false),
+ array('id'=>'ITN013','name'=>'CD drive','quantity'=>25,'price'=>20.00,'imported'=>true),
+ array('id'=>'ITN014','name'=>'DVD drive','quantity'=>15,'price'=>80.00,'imported'=>true),
+ array('id'=>'ITN015','name'=>'Mouse pad','quantity'=>50,'price'=>5.00,'imported'=>false),
+ array('id'=>'ITN016','name'=>'Network cable','quantity'=>40,'price'=>8.00,'imported'=>true),
+ array('id'=>'ITN017','name'=>'Case','quantity'=>8,'price'=>65.00,'imported'=>false),
+ array('id'=>'ITN018','name'=>'Surge protector','quantity'=>45,'price'=>15.00,'imported'=>false),
+ array('id'=>'ITN019','name'=>'Speaker','quantity'=>35,'price'=>65.00,'imported'=>false),
+ );
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php
index a49077b5..026d1a5a 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php
@@ -1,86 +1,86 @@
-<?php
-
-class Sample2 extends TPage
-{
- protected function getData()
- {
- return array(
- array(
- 'ISBN'=>'0596007124',
- 'title'=>'Head First Design Patterns',
- 'publisher'=>'O\'Reilly Media, Inc.',
- 'price'=>29.67,
- 'instock'=>true,
- 'rating'=>4,
- ),
- array(
- 'ISBN'=>'0201633612',
- 'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>47.04,
- 'instock'=>true,
- 'rating'=>5,
- ),
- array(
- 'ISBN'=>'0321247140',
- 'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>37.49,
- 'instock'=>true,
- 'rating'=>4,
- ),
- array(
- 'ISBN'=>'0201485672',
- 'title'=>'Refactoring: Improving the Design of Existing Code',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>47.14,
- 'instock'=>true,
- 'rating'=>3,
- ),
- array(
- 'ISBN'=>'0321213351',
- 'title'=>'Refactoring to Patterns',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>38.49,
- 'instock'=>true,
- 'rating'=>2,
- ),
- array(
- 'ISBN'=>'0735619670',
- 'title'=>'Code Complete',
- 'publisher'=>'Microsoft Press',
- 'price'=>32.99,
- 'instock'=>false,
- 'rating'=>4,
- ),
- array(
- 'ISBN'=>'0321278658',
- 'title'=>'Extreme Programming Explained : Embrace Change',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>34.99,
- 'instock'=>true,
- 'rating'=>3,
- ),
- );
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
- }
-
- public function toggleColumnVisibility($sender,$param)
- {
- foreach($this->DataGrid->Columns as $index=>$column)
- $column->Visible=$sender->Items[$index]->Selected;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-}
-
+<?php
+
+class Sample2 extends TPage
+{
+ protected function getData()
+ {
+ return array(
+ array(
+ 'ISBN'=>'0596007124',
+ 'title'=>'Head First Design Patterns',
+ 'publisher'=>'O\'Reilly Media, Inc.',
+ 'price'=>29.67,
+ 'instock'=>true,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0201633612',
+ 'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>47.04,
+ 'instock'=>true,
+ 'rating'=>5,
+ ),
+ array(
+ 'ISBN'=>'0321247140',
+ 'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>37.49,
+ 'instock'=>true,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0201485672',
+ 'title'=>'Refactoring: Improving the Design of Existing Code',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>47.14,
+ 'instock'=>true,
+ 'rating'=>3,
+ ),
+ array(
+ 'ISBN'=>'0321213351',
+ 'title'=>'Refactoring to Patterns',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>38.49,
+ 'instock'=>true,
+ 'rating'=>2,
+ ),
+ array(
+ 'ISBN'=>'0735619670',
+ 'title'=>'Code Complete',
+ 'publisher'=>'Microsoft Press',
+ 'price'=>32.99,
+ 'instock'=>false,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0321278658',
+ 'title'=>'Extreme Programming Explained : Embrace Change',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>34.99,
+ 'instock'=>true,
+ 'rating'=>3,
+ ),
+ );
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+ }
+
+ public function toggleColumnVisibility($sender,$param)
+ {
+ foreach($this->DataGrid->Columns as $index=>$column)
+ $column->Visible=$sender->Items[$index]->Selected;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php
index bb18f36b..74085a0f 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php
@@ -1,190 +1,190 @@
-<?php
-
-class Sample3 extends TPage
-{
- private $_data=null;
-
- protected function getData()
- {
- if($this->_data===null)
- $this->loadData();
- return $this->_data;
- }
-
- protected function loadData()
- {
- // We use viewstate keep track of data.
- // In real applications, data should come from database using an SQL SELECT statement.
- // In the following tabular data, field 'ISBN' is the primary key.
- // All update and delete operations should come with an 'id' value in order to go through.
- if(($this->_data=$this->getViewState('Data',null))===null)
- {
- $this->_data=array(
- array(
- 'ISBN'=>'0596007124',
- 'title'=>'Head First Design Patterns',
- 'publisher'=>'O\'Reilly Media, Inc.',
- 'price'=>29.67,
- 'instock'=>true,
- 'rating'=>4,
- ),
- array(
- 'ISBN'=>'0201633612',
- 'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>47.04,
- 'instock'=>true,
- 'rating'=>5,
- ),
- array(
- 'ISBN'=>'0321247140',
- 'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>37.49,
- 'instock'=>true,
- 'rating'=>4,
- ),
- array(
- 'ISBN'=>'0201485672',
- 'title'=>'Refactoring: Improving the Design of Existing Code',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>47.14,
- 'instock'=>true,
- 'rating'=>3,
- ),
- array(
- 'ISBN'=>'0321213351',
- 'title'=>'Refactoring to Patterns',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>38.49,
- 'instock'=>true,
- 'rating'=>2,
- ),
- array(
- 'ISBN'=>'0735619670',
- 'title'=>'Code Complete',
- 'publisher'=>'Microsoft Press',
- 'price'=>32.99,
- 'instock'=>false,
- 'rating'=>4,
- ),
- array(
- 'ISBN'=>'0321278658 ',
- 'title'=>'Extreme Programming Explained : Embrace Change',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>34.99,
- 'instock'=>true,
- 'rating'=>3,
- ),
- );
- $this->saveData();
- }
- }
-
- protected function saveData()
- {
- $this->setViewState('Data',$this->_data);
- }
-
- 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)
- $this->loadData();
- $updateRow=null;
- foreach($this->_data as $index=>$row)
- if($row['ISBN']===$isbn)
- $updateRow=&$this->_data[$index];
- if($updateRow!==null)
- {
- $updateRow['title']=$title;
- $updateRow['publisher']=$publisher;
- $updateRow['price']=TPropertyValue::ensureFloat(ltrim($price,'$'));
- $updateRow['instock']=TPropertyValue::ensureBoolean($instock);
- $updateRow['rating']=TPropertyValue::ensureInteger($rating);
- $this->saveData();
- }
- }
-
- protected function deleteBook($isbn)
- {
- // In real applications, data should be saved to database using an SQL DELETE statement
- if($this->_data===null)
- $this->loadData();
- $deleteIndex=-1;
- foreach($this->_data as $index=>$row)
- if($row['ISBN']===$isbn)
- $deleteIndex=$index;
- if($deleteIndex>=0)
- {
- unset($this->_data[$deleteIndex]);
- $this->saveData();
- }
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
- }
-
- public function itemCreated($sender,$param)
- {
- $item=$param->Item;
- if($item->ItemType==='EditItem')
- {
- // set column width of textboxes
- $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->DeleteColumn->Button->Attributes->onclick='if(!confirm(\'Are you sure?\')) return false;';
- }
- }
-
- public function editItem($sender,$param)
- {
- $this->DataGrid->EditItemIndex=$param->Item->ItemIndex;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-
- public function saveItem($sender,$param)
- {
- $item=$param->Item;
- $this->updateBook(
- $this->DataGrid->DataKeys[$item->ItemIndex], // ISBN
- $item->BookTitleColumn->TextBox->Text, // title
- $item->PublisherColumn->TextBox->Text, // publisher
- $item->PriceColumn->TextBox->Text, // price
- $item->InStockColumn->CheckBox->Checked, // instock
- $item->RatingColumn->DropDownList->SelectedValue // rating
- );
- $this->DataGrid->EditItemIndex=-1;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-
- public function cancelItem($sender,$param)
- {
- $this->DataGrid->EditItemIndex=-1;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-
- public function deleteItem($sender,$param)
- {
- $this->deleteBook($this->DataGrid->DataKeys[$param->Item->ItemIndex]);
- $this->DataGrid->EditItemIndex=-1;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-}
-
+<?php
+
+class Sample3 extends TPage
+{
+ private $_data=null;
+
+ protected function getData()
+ {
+ if($this->_data===null)
+ $this->loadData();
+ return $this->_data;
+ }
+
+ protected function loadData()
+ {
+ // We use viewstate keep track of data.
+ // In real applications, data should come from database using an SQL SELECT statement.
+ // In the following tabular data, field 'ISBN' is the primary key.
+ // All update and delete operations should come with an 'id' value in order to go through.
+ if(($this->_data=$this->getViewState('Data',null))===null)
+ {
+ $this->_data=array(
+ array(
+ 'ISBN'=>'0596007124',
+ 'title'=>'Head First Design Patterns',
+ 'publisher'=>'O\'Reilly Media, Inc.',
+ 'price'=>29.67,
+ 'instock'=>true,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0201633612',
+ 'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>47.04,
+ 'instock'=>true,
+ 'rating'=>5,
+ ),
+ array(
+ 'ISBN'=>'0321247140',
+ 'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>37.49,
+ 'instock'=>true,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0201485672',
+ 'title'=>'Refactoring: Improving the Design of Existing Code',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>47.14,
+ 'instock'=>true,
+ 'rating'=>3,
+ ),
+ array(
+ 'ISBN'=>'0321213351',
+ 'title'=>'Refactoring to Patterns',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>38.49,
+ 'instock'=>true,
+ 'rating'=>2,
+ ),
+ array(
+ 'ISBN'=>'0735619670',
+ 'title'=>'Code Complete',
+ 'publisher'=>'Microsoft Press',
+ 'price'=>32.99,
+ 'instock'=>false,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0321278658 ',
+ 'title'=>'Extreme Programming Explained : Embrace Change',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>34.99,
+ 'instock'=>true,
+ 'rating'=>3,
+ ),
+ );
+ $this->saveData();
+ }
+ }
+
+ protected function saveData()
+ {
+ $this->setViewState('Data',$this->_data);
+ }
+
+ 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)
+ $this->loadData();
+ $updateRow=null;
+ foreach($this->_data as $index=>$row)
+ if($row['ISBN']===$isbn)
+ $updateRow=&$this->_data[$index];
+ if($updateRow!==null)
+ {
+ $updateRow['title']=$title;
+ $updateRow['publisher']=$publisher;
+ $updateRow['price']=TPropertyValue::ensureFloat(ltrim($price,'$'));
+ $updateRow['instock']=TPropertyValue::ensureBoolean($instock);
+ $updateRow['rating']=TPropertyValue::ensureInteger($rating);
+ $this->saveData();
+ }
+ }
+
+ protected function deleteBook($isbn)
+ {
+ // In real applications, data should be saved to database using an SQL DELETE statement
+ if($this->_data===null)
+ $this->loadData();
+ $deleteIndex=-1;
+ foreach($this->_data as $index=>$row)
+ if($row['ISBN']===$isbn)
+ $deleteIndex=$index;
+ if($deleteIndex>=0)
+ {
+ unset($this->_data[$deleteIndex]);
+ $this->saveData();
+ }
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+ }
+
+ public function itemCreated($sender,$param)
+ {
+ $item=$param->Item;
+ if($item->ItemType==='EditItem')
+ {
+ // set column width of textboxes
+ $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->DeleteColumn->Button->Attributes->onclick='if(!confirm(\'Are you sure?\')) return false;';
+ }
+ }
+
+ public function editItem($sender,$param)
+ {
+ $this->DataGrid->EditItemIndex=$param->Item->ItemIndex;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function saveItem($sender,$param)
+ {
+ $item=$param->Item;
+ $this->updateBook(
+ $this->DataGrid->DataKeys[$item->ItemIndex], // ISBN
+ $item->BookTitleColumn->TextBox->Text, // title
+ $item->PublisherColumn->TextBox->Text, // publisher
+ $item->PriceColumn->TextBox->Text, // price
+ $item->InStockColumn->CheckBox->Checked, // instock
+ $item->RatingColumn->DropDownList->SelectedValue // rating
+ );
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function cancelItem($sender,$param)
+ {
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function deleteItem($sender,$param)
+ {
+ $this->deleteBook($this->DataGrid->DataKeys[$param->Item->ItemIndex]);
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php
index f9c0804d..ba7cba11 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php
@@ -1,21 +1,21 @@
-<?php
-
-Prado::using('Application.pages.Controls.Samples.TDataGrid.Sample2');
-
-class Sample4 extends Sample2
-{
- protected function sortData($data,$key)
- {
- $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}');
- usort($data,$compare) ;
- return $data ;
- }
-
- public function sortDataGrid($sender,$param)
- {
- $this->DataGrid->DataSource=$this->sortData($this->Data,$param->SortExpression);
- $this->DataGrid->dataBind();
- }
-}
-
+<?php
+
+Prado::using('Application.pages.Controls.Samples.TDataGrid.Sample2');
+
+class Sample4 extends Sample2
+{
+ protected function sortData($data,$key)
+ {
+ $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}');
+ usort($data,$compare) ;
+ return $data ;
+ }
+
+ public function sortDataGrid($sender,$param)
+ {
+ $this->DataGrid->DataSource=$this->sortData($this->Data,$param->SortExpression);
+ $this->DataGrid->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php
index bdca2ca8..fcf075ea 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php
@@ -1,68 +1,68 @@
-<?php
-
-Prado::using('Application.pages.Controls.Samples.TDataGrid.Sample1');
-
-class Sample5 extends Sample1
-{
- public function changePage($sender,$param)
- {
- $this->DataGrid->CurrentPageIndex=$param->NewPageIndex;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-
- public function pagerCreated($sender,$param)
- {
- $param->Pager->Controls->insertAt(0,'Page: ');
- }
-
- public function changePagerPosition($sender,$param)
- {
- $top=$sender->Items[0]->Selected;
- $bottom=$sender->Items[1]->Selected;
- if($top && $bottom)
- $position='TopAndBottom';
- else if($top)
- $position='Top';
- else if($bottom)
- $position='Bottom';
- else
- $position='';
- if($position==='')
- $this->DataGrid->PagerStyle->Visible=false;
- else
- {
- $this->DataGrid->PagerStyle->Position=$position;
- $this->DataGrid->PagerStyle->Visible=true;
- }
- }
-
- public function useNumericPager($sender,$param)
- {
- $this->DataGrid->PagerStyle->Mode='Numeric';
- $this->DataGrid->PagerStyle->NextPageText=$this->NextPageText->Text;
- $this->DataGrid->PagerStyle->PrevPageText=$this->PrevPageText->Text;
- $this->DataGrid->PagerStyle->PageButtonCount=$this->PageButtonCount->Text;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-
- public function useNextPrevPager($sender,$param)
- {
- $this->DataGrid->PagerStyle->Mode='NextPrev';
- $this->DataGrid->PagerStyle->NextPageText=$this->NextPageText->Text;
- $this->DataGrid->PagerStyle->PrevPageText=$this->PrevPageText->Text;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-
- public function changePageSize($sender,$param)
- {
- $this->DataGrid->PageSize=TPropertyValue::ensureInteger($this->PageSize->Text);
- $this->DataGrid->CurrentPageIndex=0;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-}
-
+<?php
+
+Prado::using('Application.pages.Controls.Samples.TDataGrid.Sample1');
+
+class Sample5 extends Sample1
+{
+ public function changePage($sender,$param)
+ {
+ $this->DataGrid->CurrentPageIndex=$param->NewPageIndex;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function pagerCreated($sender,$param)
+ {
+ $param->Pager->Controls->insertAt(0,'Page: ');
+ }
+
+ public function changePagerPosition($sender,$param)
+ {
+ $top=$sender->Items[0]->Selected;
+ $bottom=$sender->Items[1]->Selected;
+ if($top && $bottom)
+ $position='TopAndBottom';
+ else if($top)
+ $position='Top';
+ else if($bottom)
+ $position='Bottom';
+ else
+ $position='';
+ if($position==='')
+ $this->DataGrid->PagerStyle->Visible=false;
+ else
+ {
+ $this->DataGrid->PagerStyle->Position=$position;
+ $this->DataGrid->PagerStyle->Visible=true;
+ }
+ }
+
+ public function useNumericPager($sender,$param)
+ {
+ $this->DataGrid->PagerStyle->Mode='Numeric';
+ $this->DataGrid->PagerStyle->NextPageText=$this->NextPageText->Text;
+ $this->DataGrid->PagerStyle->PrevPageText=$this->PrevPageText->Text;
+ $this->DataGrid->PagerStyle->PageButtonCount=$this->PageButtonCount->Text;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function useNextPrevPager($sender,$param)
+ {
+ $this->DataGrid->PagerStyle->Mode='NextPrev';
+ $this->DataGrid->PagerStyle->NextPageText=$this->NextPageText->Text;
+ $this->DataGrid->PagerStyle->PrevPageText=$this->PrevPageText->Text;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function changePageSize($sender,$param)
+ {
+ $this->DataGrid->PageSize=TPropertyValue::ensureInteger($this->PageSize->Text);
+ $this->DataGrid->CurrentPageIndex=0;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample6.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample6.php
index 90e3f7fe..3f24c9ac 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample6.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample6.php
@@ -1,56 +1,56 @@
-<?php
-
-Prado::using('Application.pages.Controls.Samples.TDataGrid.Sample1');
-
-class Sample6 extends Sample1
-{
- /**
- * Returns a subset of data.
- * In MySQL database, this can be replaced by LIMIT clause
- * in an SQL select statement.
- * @param integer the starting index of the row
- * @param integer number of rows to be returned
- * @return array subset of data
- */
- protected function getDataRows($offset,$rows)
- {
- $data=$this->getData();
- $page=array();
- for($i=0;$i<$rows;++$i)
- {
- if($offset+$i<$this->getRowCount())
- $page[$i]=$data[$offset+$i];
- }
- return $page;
- }
-
- /**
- * Returns total number of data rows.
- * In real DB applications, this may be replaced by an SQL select
- * query with count().
- * @return integer total number of data rows
- */
- protected function getRowCount()
- {
- return 19;
- }
-
- public function onLoad($param)
- {
- if(!$this->IsPostBack)
- {
- $this->DataGrid->DataSource=$this->getDataRows(0,$this->DataGrid->PageSize);
- $this->DataGrid->dataBind();
- }
- }
-
- public function changePage($sender,$param)
- {
- $this->DataGrid->CurrentPageIndex=$param->NewPageIndex;
- $offset=$param->NewPageIndex*$this->DataGrid->PageSize;
- $this->DataGrid->DataSource=$this->getDataRows($offset,$this->DataGrid->PageSize);
- $this->DataGrid->dataBind();
- }
-}
-
+<?php
+
+Prado::using('Application.pages.Controls.Samples.TDataGrid.Sample1');
+
+class Sample6 extends Sample1
+{
+ /**
+ * Returns a subset of data.
+ * In MySQL database, this can be replaced by LIMIT clause
+ * in an SQL select statement.
+ * @param integer the starting index of the row
+ * @param integer number of rows to be returned
+ * @return array subset of data
+ */
+ protected function getDataRows($offset,$rows)
+ {
+ $data=$this->getData();
+ $page=array();
+ for($i=0;$i<$rows;++$i)
+ {
+ if($offset+$i<$this->getRowCount())
+ $page[$i]=$data[$offset+$i];
+ }
+ return $page;
+ }
+
+ /**
+ * Returns total number of data rows.
+ * In real DB applications, this may be replaced by an SQL select
+ * query with count().
+ * @return integer total number of data rows
+ */
+ protected function getRowCount()
+ {
+ return 19;
+ }
+
+ public function onLoad($param)
+ {
+ if(!$this->IsPostBack)
+ {
+ $this->DataGrid->DataSource=$this->getDataRows(0,$this->DataGrid->PageSize);
+ $this->DataGrid->dataBind();
+ }
+ }
+
+ public function changePage($sender,$param)
+ {
+ $this->DataGrid->CurrentPageIndex=$param->NewPageIndex;
+ $offset=$param->NewPageIndex*$this->DataGrid->PageSize;
+ $this->DataGrid->DataSource=$this->getDataRows($offset,$this->DataGrid->PageSize);
+ $this->DataGrid->dataBind();
+ }
+}
+
?> \ No newline at end of file