问题
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