summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Controls/Samples
diff options
context:
space:
mode:
authorxue <>2006-02-05 00:47:08 +0000
committerxue <>2006-02-05 00:47:08 +0000
commit9bf518fc15ed3945b8f770bd10c855a89c7707bc (patch)
treeaafb00affbe20264fcea35c88c23ed864bcd5be9 /demos/quickstart/protected/pages/Controls/Samples
parentc397b21f03fa535ec1c742dac1a66e315879cf10 (diff)
Updated sorting example of TDataGrid.
Diffstat (limited to 'demos/quickstart/protected/pages/Controls/Samples')
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php76
1 files changed, 3 insertions, 73 deletions
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php
index 620dfc0f..f9c0804d 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php
@@ -1,69 +1,9 @@
<?php
-class Sample4 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,
- ),
- );
- }
+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;}');
@@ -71,16 +11,6 @@ class Sample4 extends TPage
return $data ;
}
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
- }
-
public function sortDataGrid($sender,$param)
{
$this->DataGrid->DataSource=$this->sortData($this->Data,$param->SortExpression);