scroll pager extension In Yii2

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 12:43:15

问题


i am using Yii2 with a scroll pager extension: http://kop.github.io/yii2-scroll-pager/

Here's my code:

echo yii\widgets\ListView::widget([
    'dataProvider' => $boards,
    'itemView' => 'boards',
    'layout' => $template,
    'itemOptions' => ['class' => 'item'],
    'pager' => ['class' => \kop\y2sp\ScrollPager::className()]
]);

and i am seetting dataProvider from modal The Code is given below

$dataProvider = new ActiveDataProvider([
        'query' => Boards::find(),
        'pagination' => array('pageSize' => 3),
    ]);

    return $dataProvider;

But i am getting the following exception

PHP Notice – yii\base\ErrorException Undefined variable: boards

Can any when tell me what is the wrong ?


回答1:


Is $boards defined?

From what i figure

'dataProvider' => $boards,

is not defined, i do not think it has anything to do with ScrollPager. Try removing

'pager' => ['class' => \kop\y2sp\ScrollPager::className()]

you will probably get the same error.



来源:https://stackoverflow.com/questions/27264287/scroll-pager-extension-in-yii2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!