diff options
author | xue <> | 2006-02-05 03:48:45 +0000 |
---|---|---|
committer | xue <> | 2006-02-05 03:48:45 +0000 |
commit | 08bf73e5621cdc384db7c416e6e8b689123bb3a8 (patch) | |
tree | 81e9174731b53b2924ccc24804c50cc6d7e0b47d /framework/Web | |
parent | 9bf518fc15ed3945b8f770bd10c855a89c7707bc (diff) |
Added paging example of TDataGrid.
Diffstat (limited to 'framework/Web')
-rw-r--r-- | framework/Web/UI/WebControls/TDataGrid.php | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php index 91b0c374..b0dafb5d 100644 --- a/framework/Web/UI/WebControls/TDataGrid.php +++ b/framework/Web/UI/WebControls/TDataGrid.php @@ -605,9 +605,9 @@ class TDataGrid extends TBaseDataList implements INamingContainer else if(strcasecmp($command,'page')===0)
{
$p=$param->getCommandParameter();
- if(strcasecmp($p,'next'))
+ if(strcasecmp($p,'next')===0)
$pageIndex=$this->getCurrentPageIndex()+1;
- else if(strcasecmp($p,'prev'))
+ else if(strcasecmp($p,'prev')===0)
$pageIndex=$this->getCurrentPageIndex()-1;
else
$pageIndex=TPropertyValue::ensureInteger($p)-1;
@@ -812,11 +812,10 @@ class TDataGrid extends TBaseDataList implements INamingContainer protected function restoreGridFromViewState()
{
$this->reset();
- if(($itemCount=$this->getViewState('ItemCount',0))<=0)
- return;
+ $itemCount=$this->getViewState('ItemCount',0);
$this->_pagedDataSource=$ds=$this->createPagedDataSource();
$allowPaging=$ds->getAllowPaging();
- if($allowPaging)
+ if($allowPaging && $ds->getAllowCustomPaging())
$ds->setDataSource(new TDummyDataSource($itemCount));
else
$ds->setDataSource(new TDummyDataSource($this->getViewState('DataSourceCount',0)));
@@ -826,7 +825,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer $items=$this->getItems();
$items->clear();
- if($columns->getCount()>0)
+ if(($columnCount=$columns->getCount())>0)
{
foreach($columns as $column)
$column->initialize();
@@ -1239,15 +1238,14 @@ class TDataGrid extends TBaseDataList implements INamingContainer if($pagerStyle)
{
$item->getStyle()->mergeWith($pagerStyle);
- $mode=$pagerStyle->getMode();
if($index===0)
{
- if($mode==='Bottom')
+ if($pagerStyle->getPosition()==='Bottom' || !$pagerStyle->getVisible())
$item->setVisible(false);
}
else
{
- if($mode==='Top')
+ if($pagerStyle->getPosition()==='Top' || !$pagerStyle->getVisible())
$item->setVisible(false);
}
}
|