joinWith('user'); $query->joinWith('auctions'); $query->joinWith('lots'); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort'=> ['defaultOrder' => ['id'=>SORT_DESC]], ]); $dataProvider->sort->attributes['at_org'] = [ 'asc' => ['user.at_org' => SORT_ASC], 'desc' => ['user.at_org' => SORT_DESC], ]; $dataProvider->sort->attributes['name'] = [ 'asc' => ['lots.name' => SORT_ASC], 'desc' => ['lots.name' => SORT_DESC], ]; //$dataProvider->sort['defaultOrder'] = ['eventlog.id' => SORT_DESC]; $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere([ //'id' => $this->id, //'user_id' => $this->user_id, 'auk_id' => $this->auk_id, //'date' => $this->date, ]); $query->andFilterWhere(['like', 'ip', $this->ip]) ->andFilterWhere(['like', 'at_org', $this->at_org]) ->andFilterWhere(['like', 'lots.name', $this->name]) ->andFilterWhere(['like', 'action', $this->action]) ->andFilterWhere(['like', 'eventlog.date', $this->date]); return $dataProvider; } }