How to make your own view in for searchModel? Do not gridView, but assemble yourself. I suffer a day! Here is the model:
<?php namespace backend\models\search; use Yii; use yii\base\Model; use yii\data\ActiveDataProvider; use common\models\Truck; /** * ArticleSearch represents the model behind the search form about `common\models\Article`. */ class TruckSearch extends Truck { /** * @inheritdoc */ public function rules() { return [ [['id'], 'integer'], [['id', 'type_id', 'name', 'carrying'], 'safe'], ]; } /** * @inheritdoc */ public function scenarios() { // bypass scenarios() implementation in the parent class return Model::scenarios(); } /** * Creates data provider instance with search query applied * @return ActiveDataProvider */ public function search($params) { $query = Truck::find(); $dataProvider = new ActiveDataProvider([ 'query' => $query, ]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere([ 'id' => $this->id, 'type_id' => $this->type_id, 'name' => $this->name, 'carrying' => $this->carrying, 'status' => $this->status, ]); /*$query->andFilterWhere(['like', 'slug', $this->slug]) ->andFilterWhere(['like', 'title', $this->title]) ->andFilterWhere(['like', 'body', $this->body]);*/ return $dataProvider; } }