YII2 Native Sql+gridview Paging problem
http://www.yiichina.com/question/235
Yii2 The use of the combination of GridView and DropDownList
http://www.yiichina.com/tutorial/473
<?= $form->field ( $model, ' provinces ')->dropdownlist (Arrayhelper::map (common\models \globalregion::find ()->where ([ ' region_type ' =>1])- >asarray ()->all (), ' region_id ', ' region_name '), [ ' style ' => ' width:150px ', ' prompt ' = > ' Please select Province ', ' onchange ' => ' $. Post ("index.php?r=user/lists&id=". $ ("#user-countrys"). HTML ("< Option value= > Please select County </option> "); $ ("#user-citys"). Append (data); });‘, ]); ?>
<?= $form->field ( $model , ' region_id ') , ' style ' => width:150px ', ' prompt ' => ' Please select City ', onchange ' => ' $.post ("index.php?r=user/lists&id=". Span class= "hljs-string" "" "+$ (This). Val (), function (data) {$ (" #user-countrys "). HTML (" <option value=> please select County < /option> "); $ ("#user-countrys"). Append (data); });‘, ]); ?>
<?=< Span class= "hljs-variable" > $form->field ( $model, ' region_id ', ' style ' => ' width:150px ', ' prompt ' => ' Please select County ', ' onchange ' => ' $.post ("Index.php?r=branches/lists& ; Id= '. ?>
public function actionLists () {
< Span class= "Hljs-keyword" > // Find out what's underneath
$regionmodel =globalregion::find ()->where ([ ' parent_id ' =>< Span class= "hljs-variable" >$_get[ ' ID ']])->asarray ()->all (); foreach ( $regionmodel as $v) { $str = "<option value=". $v [ ' region_id ']. " > ". $v [ ' region_name ']. " </option> "; echo $str;}
Yii2 in GridView