I am trying to create feedback page by put gridview on the page to show the feedbacklist, and I have plan to put the list replay under the current comment.
This is the following code I made:
'columns' => [
[ 'attribute' => 'iduser.photo',
'format' => 'html',
'value'=> function($data) { return Html::img($data->imageurl) . " <p class='feedback-username'>" . $data->username . "</p>"; },
'contentOptions'=>['style'=>'max-width: 10px; max-height: 10px'],
],
[ 'attribute' => 'KOMENTAR',
'format' => 'raw',
'value' => function($model) { return $model->KOMENTAR ."<br><p class='feedback-date'>". $model->TANGGAL ."</p><hr><div id='replay'><ul></ul></div>";},
],
[ 'class' => 'yii\grid\ActionColumn',
'contentOptions'=>['style'=>'width: 5px;'],
'template' => '{update} {delete}',
'visible' => !Yii::$app->user->isGuest,
],
I want to use jQuery for slip list replay in id = replay > ul
This the controller I made:
public function actionReplay()
{
$searchModel = new FeedbackSearch();
$dataProvider = $searchModel->searchReplay();;
return $this->render('replay', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider
]);
}
And this is the model:
public function searchReplay()
{
$dataProvider = Feedback::find()->where("REPLAYED = '1'")->all();
return $dataProvider;
}
The view to show the list:
<?php
foreach ($dataProvider as $model)
{
echo $model->KOMENTAR;
}
How can i put the list data in grid view? I think of jquery but i still have no idea.