I am trying to display a listview using ajax, but it gives me the following error:
Exception (Invalid Configuration) 'yii\base\InvalidConfigException' with message '
;The "dataProvider" property must be set.
Controller:
public function actionLoadListviewAjax()
{
$dataProvider =
return $this->renderAjax('myview', [ 'dataProvider' => $dataProvider ]);
}
View:
echo ListView::widget([
'dataProvider' => $dataProvider,
'itemView' => 'items',
'options' => ['class' => 'list-view-post'],
'summary' => '',
'emptyText' => '',
]);
$ dataProvder:
<pre>yii\data\ArrayDataProvider Object
(
[key] =>
[allModels] => Array
(
[0] => Array
(
[RecommendationCategory] =>
[ID] => 37
[GUID] =>
[Title] => test
[WallPostTypeID] => 1
[RecommendationCategoryID] => 0
[CommentsJSON] =>
[TotalComments] =>
[PostedMessage] => test
[FirstName] => test
[LastName] => test
[ProfileImagePath] => Lighthouse.jpg
[AddedOn] => 2015-07-18 15:14:06
[ImagePath] =>
[CommentProfileImagePath] =>
[IsSubscribe] => 1
)
)
[id] =>
[_sort:yii\data\BaseDataProvider:private] =>
[_pagination:yii\data\BaseDataProvider:private] =>
[_keys:yii\data\BaseDataProvider:private] =>
[_models:yii\data\BaseDataProvider:private] =>
[_totalCount:yii\data\BaseDataProvider:private] =>
[_events:yii\base\Component:private] => Array
(
)
[_behaviors:yii\base\Component:private] =>
)
I tried renderPartial too, but still the same error. Any ideas why this gives liberation?
Update:
In my itemView file, itemsI have another list for which it provides an exception.
source
share