Yii2 GridView与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'=>'请选择省', 'onchange'=>' $.post("index.php?r=user/lists&id='.'"+$(this).val(),function(data){ $("#user-citys").html("<option value= >请选择市</option>");$("#user-countrys").html("<option value= >请选择县</option>"); $("#user-citys").append(data); });', ]); ?>

<?=$form->field($model, 'citys')->dropDownList(ArrayHelper::map([],'region_id','region_name'), [ 'style'=>'width:150px', 'prompt'=>'请选择市', 'onchange'=>' $.post("index.php?r=user/lists&id='.'"+$(this).val(),function(data){ $("#user-countrys").html("<option value=>请选择县</option>"); $("#user-countrys").append(data); });', ]); ?>

<?=$form->field($model, 'countrys')->dropDownList(ArrayHelper::map([],'region_id','region_name'), [ 'style'=>'width:150px', 'prompt'=>'请选择县', 'onchange'=>' $.post("index.php?r=branches/lists&id='.'"+$(this).val(),function(data){ });', ]); ?>

public function actionLists(){

//查出底下的内容

$regionmodel=GlobalRegion::find()->where(['parent_id'=>$_GET['id']])->asarray()->all(); foreach($regionmodel as $v){ $str="<option value=".$v['region_id'].">".$v['region_name']."</option>"; echo $str; } }

  

最新文章

  1. AWS开发人员认证考试样题解析
  2. Python Set Literals
  3. jmeter 内存溢出解决方法
  4. Thread类详解
  5. Educational Codeforces Round 4 D. The Union of k-Segments 排序
  6. C#学习笔记(六):可空类型、匿名方法和迭代器
  7. Cassandra查询语言CQL的基本使用
  8. ios 从微信返回自己的app
  9. 安装Oracle11g的依赖包
  10. [BZOJ]3527 力(ZJOI2014)
  11. 【LUOGU???】WD与数列 sam 启发式合并
  12. 极速认识RSS!
  13. ORA-12537:TNS:connectionclosed错误处理过程
  14. Windows下的Anaconda+OpenCV的环境配置
  15. Atitti 住房部建设指南
  16. [nginx]location语法
  17. re 正则
  18. 面试-SizeOf一个对象会得到什么?
  19. Streaming Big Data: Storm, Spark and Samza--转载
  20. spring 3.0系统集成webservice

热门文章

  1. 【和孩子一起学编程】 python笔记--第三天
  2. QGroundControl编译出错记录
  3. POJ 2528(线段树+离散化+特殊离散化)网上博客很少有人真正写对!!! 是POJ数据太水...
  4. ubuntu下安装apidoc
  5. Linux常用命令的使用方法
  6. php开发面试题---php缓存总结
  7. python re模块常用的正则表达式
  8. Excel表格文本格式的数字和数字格式如何批量转换
  9. css点击高亮
  10. 9.Jmeter自定义Sample(自定义测试内容)完成测试