简体   繁体   中英

Yii style pagination with CActiveDataProvider or CListView

I want to change the class of the Yii pagination. It looks terrible. But i don't know how to change the class. I tried many different things already, here's what i have now:

CONTROLLER CODE:

$dataProvider=new CActiveDataProvider('Producten',array(
         'criteria'=>array(
         'condition'=>'categorie=:cat AND subcategorie=:subcat',
         'params'=>array(':cat'=>$cat,':subcat'=>$subcat),
     ),
     'sort'=>array(
        'attributes'=>array(
        'naam', 'prijs'
     ),
     ),
    'pagination'=>array(
        'pageSize'=>1,
     ),
));

VIEW CODE:

$this->widget('zii.widgets.CListView', array(
    'dataProvider'=>$dataProvider,
    'itemView'=>'_view',
    'htmlOptions' => array('class' => 'pag'), //<---------- THIS DOES NOT WORK
));

The Pagination works, but the styling is aweful. The current class is: yiiPager

Please help :)

You can customize your pagination style like below:

'pager' => array(
            'firstPageLabel' => '<<',
            'lastPageLabel' => '>>',
            'prevPageLabel' => '>',
            'nextPageLabel' => '<',
            'nextPageCssClass' => 'ClassName',
            'previousPageCssClass' => 'ClassName',
            'selectedPageCssClass' => 'ClassName',
            'internalPageCssClass' => 'ClassName',
        ),
'pagerCssClass' => 'ClassName'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM