private function search() { // Warning: Please modify the following code to remove attributes that // should not be searched. $query = \app\models\AccHist::find(); //$sort = new CSort(); //$sort->defaultOrder = 'dt DESC'; return new \yii\data\ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['dt' => SORT_DESC]], 'pagination' => array('pageSize' => 4)]); }
/** * Retrieves a list of models based on the current search/filter conditions. * * Typical usecase: * - Initialize the model fields with values from filter form. * - Execute this method to get CActiveDataProvider instance which will filter * models according to data in model fields. * - Pass data provider to CGridView, CListView or any similar widget. * * @return CActiveDataProvider the data provider that can return the models * based on the search/filter conditions. */ public function search($params) { $query = AccHist::find(); $dataProvider = new \yii\data\ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'account_id' => $this->account_id, 'dt' => $this->dt, 'type' => $this->type]); $query->andFilterWhere(['like', 'details', $this->details]); return $dataProvider; }