码迷,mamicode.com
首页 > 其他好文 > 详细

EasyUI 二级联动

时间:2015-12-19 19:16:48      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:

jQuery(function(){ 
  // 省级 
   $(‘#province‘).combobox({
        valueField:‘itemvalue‘, //值字段
        textField:‘itemtext‘, //显示的字段
        url:‘/user/sort/province_list‘,
        panelHeight:‘auto‘,
        required:true,
        editable:true,//不可编辑,只能选择
        value:‘${user.province}‘,
        onChange:function(province){
        	//$(‘#city‘).combobox(‘clear‘);
        	$(‘#city‘).combobox({
          valueField:‘itemvalue‘, //值字段
          textField:‘itemtext‘, //显示的字段
          url:‘/user/sort/city_list?province=‘+province,
          panelHeight:‘auto‘,
          required:true,
          editable:true,//不可编辑,只能选择
          value:‘--请选择--‘
     	});
        }
     });
  //县市区 
     $(‘#city‘).combobox({
        valueField:‘itemvalue‘, //值字段
        textField:‘itemtext‘, //显示的字段
        url:‘/user/sort/city_list?province=${user.province}‘,
        panelHeight:‘auto‘,
        required:true,
        editable:true,//不可编辑,只能选择
        value:‘${user.city}‘
     });
  });

// 表单table
           <tr>
            <td align="right">地区 省级</td>
            <td align="left">
                    <input type="text" id="province" name="province" style="width: 128px"
                      class="easyui-validatebox" validType="selectValid[‘--请选择--‘]" />
            </td>
        </tr>
         <tr>
            <td align="right">地区  县市区</td>
            <td align="left">
                    <input type="text" id="city" name="city" style="width: 128px"
                      class="easyui-validatebox" validType="selectValid[‘--请选择--‘]"/>
            </td>
        </tr>

EasyUI 二级联动

标签:

原文地址:http://www.cnblogs.com/dylanzhuo/p/5059551.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!