summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php
diff options
context:
space:
mode:
authorxue <>2006-02-05 03:48:45 +0000
committerxue <>2006-02-05 03:48:45 +0000
commit08bf73e5621cdc384db7c416e6e8b689123bb3a8 (patch)
tree81e9174731b53b2924ccc24804c50cc6d7e0b47d /demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php
parent9bf518fc15ed3945b8f770bd10c855a89c7707bc (diff)
Added paging example of TDataGrid.
Diffstat (limited to 'demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php')
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php63
1 files changed, 63 insertions, 0 deletions
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php
new file mode 100644
index 00000000..6d6d967c
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php
@@ -0,0 +1,63 @@
+<?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 itemCreated($sender,$param)
+ {
+ $item=$param->Item;
+ if($item->ItemType==='Pager')
+ {
+ // prepend 'Page: ' to the pager
+ $item->Cells[0]->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->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();
+ }
+}
+
+?> \ No newline at end of file