/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = DraftGeoSub::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query]); $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; } // grid filtering conditions $query->andFilterWhere(['ID' => $this->ID, 'GEO_SUB' => $this->GEO_SUB, 'GEO_ID' => $this->GEO_ID, 'CUST_MAX_NORMAL' => $this->CUST_MAX_NORMAL, 'CUST_MAX_LAYER' => $this->CUST_MAX_LAYER, 'STATUS' => $this->STATUS, 'CREATE_AT' => $this->CREATE_AT, 'UPDATE_AT' => $this->UPDATE_AT]); $query->andFilterWhere(['like', 'GEO_DCRIP', $this->GEO_DCRIP])->andFilterWhere(['like', 'START_LAT', $this->START_LAT])->andFilterWhere(['like', 'START_LONG', $this->START_LONG])->andFilterWhere(['like', 'CITY_ID', $this->CITY_ID])->andFilterWhere(['like', 'CREATE_BY', $this->CREATE_BY])->andFilterWhere(['like', 'UPDATE_BY', $this->UPDATE_BY]); return $dataProvider; }
public function actionLisGeoSub() { $out = []; if (isset($_POST['depdrop_parents'])) { $parents = $_POST['depdrop_parents']; if ($parents != null) { $parentGeo = $parents[0]; $model = DraftGeoSub::find()->asArray()->where(['GEO_ID' => $parentGeo])->all(); foreach ($model as $key => $value) { $out[] = ['id' => $value['GEO_SUB'], 'name' => $value['GEO_SUB'] . ' - ' . $value['GEO_DCRIP']]; } echo json_encode(['output' => $out, 'selected' => '']); return; } } echo Json::encode(['output' => '', 'selected' => '']); }