не отображаются юсеры? id приходит , путь в urlManager настроил . количество при этом отображается
public function actionIndex()
{
$id = Yii::$app->request->get("id") ? Yii::$app->request->get("id") : 1;
$name = Yii::$app->request->get('UsersFilterModel')['name'] ? Yii::$app->request->get('UsersFilterModel')['name'] : "%%";
....
$provider = new SqlDataProvider([
'sql' => $sql,
'params' => [
"id" => $id,
"name" => '%' . $name . '%',
],
'totalCount' => $count,
'sort' => [
'defaultOrder' => [
'alert_type_1' => SORT_ASC,
],
'attributes' => [
'full_name' => [
'desc' => ['full_name' => SORT_DESC],
'asc' => ['full_name' => SORT_ASC],
],
'profile_id' => [
'desc' => ['profile_id' => SORT_DESC],
'asc' => ['profile_id' => SORT_ASC],
],
'alert_type_1' => [
'desc' => ['alert_type_1' => SORT_DESC],
'asc' => ['alert_type_1' => SORT_ASC],
],
'alert_type_2' => [
'desc' => ['alert_type_2' => SORT_DESC],
'asc' => ['alert_type_2' => SORT_ASC],
],
'alert_type_3' => [
'desc' => ['alert_type_3' => SORT_DESC],
'asc' => ['alert_type_3' => SORT_ASC],
],
'alert_type_4' => [
'desc' => ['alert_type_4' => SORT_DESC],
'asc' => ['alert_type_4' => SORT_ASC],
],
],
],
'pagination' => [
'pageSize' => 50,
],
]);
$filterModel = new UsersFilterModel();
return $this->render("index", [
'provider' => $provider,
'totalCount' => $provider->getTotalCount(),
'filterModel' => $filterModel,
]);
код отображения юсеров
<?php
echo GridView::widget([
'dataProvider' => $provider,
'layout' => '{items}{pager}',
'columns' => [
[
'class' => 'yii\grid\SerialColumn',
],
[
'attribute' => 'full_name',
'label' => 'ФИО',
'format' => 'raw',
'value' => function ($model) {
return Html::a($model['full_name'], ['profile/index', 'id' => $model['profile_id']]);
},
$sql - секретная переменная, а вообще наверное xdebug должен показать ошибку
Обсуждают сегодня