Inheritance: extends BootPager
Exemple #1
0
                    ->all();
                    

                    
--------------------------------------------------------------------



use yii\widgets\LinkPager;


<section class="posts col-md-9">
    foreach...
    
    <div class="row text-center"><?php 
echo LinkPager::widget(['pagination' => $pagination]);
?>
</div>
    
</section>

<aside class="hidden-xs hidden-sm col-md-3">
    <?php 
echo $this->render('/site/_sidebar');
?>
</aside>



--------------------------------------------------------------------
 public function init()
 {
     parent::init();
     $this->htmlOptions['class'] = 'endless-list-pager';
 }
Exemple #3
0
    /**
     * @see		CLinkPager::createPageButton()
     */
    protected function createPageButton($label, $page, $class, $hidden, $selected)
    {
        if ($hidden || $selected) {
            $class .= ' ' . ($hidden ? self::CSS_HIDDEN_PAGE : self::CSS_SELECTED_PAGE);
        }
        $postVars = $this->getPostVars();
        if ($postVars === null) {
            return '<li class="' . $class . '">' . CHtml::link($label, $this->createPageUrl($page)) . '</li>';
        } else {
            if (self::$generateJsPage) {
                $data = CJSON::encode($postVars);
                $script = '
					function navigateToPage(_page) {

						var data = ' . $data . ';
						data.page = _page;
						' . (Yii::app()->getRequest()->getParam('pageSize') ? 'data.pageSize = ' . Yii::app()->getRequest()->getParam('pageSize') : '') . '
						' . (Yii::app()->getRequest()->getParam('sort') ? 'data.sort = "' . Yii::app()->getRequest()->getParam('sort') . '"' : '') . '

						$.post("' . Yii::app()->createUrl($this->getPages()->route) . '", data, function(responseText) {
							$("div.ui-layout-center").html(responseText);
							init();
						});

					}
				';
                Yii::app()->getClientScript()->registerScript('LinkPager_page', $script);
                self::$generateJsPage = false;
            }
            return '<li class="' . $class . '">' . CHtml::link($label, 'javascript:void(0);', array('onclick' => 'navigateToPage(' . ($page + 1) . ');')) . '</li>';
        }
    }