diff options
author | ctrlaltca <> | 2012-07-07 10:42:51 +0000 |
---|---|---|
committer | ctrlaltca <> | 2012-07-07 10:42:51 +0000 |
commit | d9f22f1f9a0bda15f9aa2d19a5624f46c0432b4c (patch) | |
tree | 07324d0db6616af1514246859a757e87419165d7 /framework/Web/UI/ActiveControls | |
parent | f10e112d93d9453276b496cd80a6b359d0f82f09 (diff) |
fix #414
Diffstat (limited to 'framework/Web/UI/ActiveControls')
-rw-r--r-- | framework/Web/UI/ActiveControls/TActiveDataGrid.php | 64 |
1 files changed, 63 insertions, 1 deletions
diff --git a/framework/Web/UI/ActiveControls/TActiveDataGrid.php b/framework/Web/UI/ActiveControls/TActiveDataGrid.php index c4ad9640..02fc68e4 100644 --- a/framework/Web/UI/ActiveControls/TActiveDataGrid.php +++ b/framework/Web/UI/ActiveControls/TActiveDataGrid.php @@ -106,6 +106,7 @@ class TActiveDataGrid extends TDataGrid implements IActiveControl, ISurroundable * If it is enabled (clickable), its command name and parameter will also be set. * It overrides the datagrid's original method to create active controls instead, thus * the pager will do callbacks instead of the regular postbacks. + * @param mixed the container pager instance of TActiveDatagridPager * @param string button type, either LinkButton or PushButton * @param boolean whether the button should be enabled * @param string caption of the button @@ -113,7 +114,7 @@ class TActiveDataGrid extends TDataGrid implements IActiveControl, ISurroundable * @param string CommandParameter corresponding to the OnCommand event of the button * @return mixed the button instance */ - protected function createPagerButton($buttonType,$enabled,$text,$commandName,$commandParameter) { + protected function createPagerButton($pager,$buttonType,$enabled,$text,$commandName,$commandParameter) { if($buttonType===TDataGridPagerButtonType::LinkButton) { if($enabled) $button=new TActiveLinkButton; @@ -132,9 +133,21 @@ class TActiveDataGrid extends TDataGrid implements IActiveControl, ISurroundable $button->setCommandName($commandName); $button->setCommandParameter($commandParameter); $button->setCausesValidation(false); + $button->getAdapter()->getBaseActiveControl()->setClientSide( + $pager->getClientSide() + ); return $button; } + protected function createPager() + { + $pager=new TActiveDataGridPager($this); + $this->buildPager($pager); + $this->onPagerCreated(new TActiveDataGridPagerEventParameter($pager)); + $this->getControls()->add($pager); + return $pager; + } + /** * Renders the datagrid. * If the datagrid did not pass the prerender phase yet, it will register itself for rendering later. @@ -765,3 +778,52 @@ class TActiveLiteralColumn extends TLiteralColumn { } } } + +/** + * TActiveDataGridPager class. + * + * TActiveDataGridPager represents a pager in an activedatagrid. + * + * @author Fabio Bas <ctrlaltca@gmail.com> + * @version $Id: TDataGrid.php 3057 2011-11-09 12:35:57Z ctrlaltca@gmail.com $ + * @package System.Web.UI.ActiveControls + * @since 3.2.1 + */ +class TActiveDataGridPager extends TDataGridPager +{ + protected $_callbackoptions; + + /** + * @return TCallbackClientSide client side request options. + */ + public function getClientSide() + { + if($this->_callbackoptions === null) + $this->_callbackoptions = new TCallbackOptions; + return $this->_callbackoptions->getClientSide(); + } +} + +/** + * TActiveDataGridPagerEventParameter class + * + * TActiveDataGridPagerEventParameter encapsulates the parameter data for + * {@link TActiveDataGrid::onPagerCreated OnPagerCreated} event of {@link TActiveDataGrid} controls. + * The {@link getPager Pager} property indicates the datagrid pager related with the event. + * + * @author Fabio Bas <ctrlaltca@gmail.com> + * @version $Id: TActiveDataGrid.php 3057 2011-11-09 12:35:57Z ctrlaltca@gmail.com $ + * @package System.Web.UI.ActiveControls + * @since 3.2.1 + */ +class TActiveDataGridPagerEventParameter extends TDataGridPagerEventParameter +{ + /** + * Constructor. + * @param TActiveDataGridPager datagrid pager related with the corresponding event + */ + public function __construct(TActiveDataGridPager $pager) + { + $this->_pager=$pager; + } +} |