From d76123127139a7cb013a0e4c17a63eb8aab57e3e Mon Sep 17 00:00:00 2001 From: "Christophe.Boulain" <> Date: Tue, 29 Sep 2009 08:33:46 +0000 Subject: Added TActiveDataGrid and TActiveRepeater from LCS --- .../Samples/TActiveDataGrid/Sample6.php | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample6.php (limited to 'demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample6.php') diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample6.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample6.php new file mode 100644 index 00000000..7b217e24 --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample6.php @@ -0,0 +1,56 @@ +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 -- cgit v1.2.3