Answer the question
In order to leave comments, you need to log in
Yii2 Filtering ListView by click and split by dates, how to implement?
Hello! Need help with filtering data displayed through ListView.
There is a CrmController.php controller that passes all data to the view
public function actionIndex()
{
$dataProvider = new ActiveDataProvider([
'query' => Requests::find()->orderBy('id ASC'),
'pagination' => [
'pageSize' => 10,
],
]);
$this->view->title = 'CRM';
return $this->render('index', ['listDataProvider' => $dataProvider]);
}
<?= ListView::widget([
'dataProvider' => $listDataProvider,
'itemView' => '_item',
]); ?>
<?php
use yii\helpers\Html;
?>
<tr>
<td><?=$model->date; ?> <?=$model->time; ?></td>
<td><?=$model->type;?></td>
<td><?=$model->contacts;?></td>
<td><?=$model->content;?></td>
<td><?=$model->status;?></td>
<td><i class="fa fa-pencil"></i> <i class="fa fa-star-o"></i></td>
</tr>
Answer the question
In order to leave comments, you need to log in
You need to create a SearchModel and use it.
read everything here: www.yiiframework.com/doc-2.0/guide-output-data-wid...
and a bit here: www.yiiframework.com/doc-2.0/guide-output-sorting.html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question