easy ui的三级联动,两级联动

2019-11-07 16:57:18 浏览数 (1)

代码语言:javascript复制
<select id="hdprovinceId" class="easyui-combobox" name="hdprovinceId" style="width:100px;" 
data-options="
editable:false,
valueField:'ID',									
textField:'TEXT',
										url:'<%=basePath%>getProvince',
onSelect: function(rec){
												getCity(rec)
}
">
</select>
<select id="hdcityId" class="easyui-combobox" name="hdcityId" style="width:100px;" 
data-options="
editable:false,
valueField:'ID',
										textField:'TEXT',
onSelect: function(rec){
												getDistrict(rec)
}
">
</select>
<select id="hddistrictId" class="easyui-combobox" name="hddistrictId" style="width:100px;" data-options="editable:false,valueField:'ID',textField:'TEXT'">
</select>

	<%--获取市 --%>
		function getCity(rec){
			var url = '<%=basePath%>getCity?id=' rec.ID;
			$('#hdcityId').combobox('loadData', []);
			$('#hddistrictId').combobox('loadData',[]);
			$('#hdcityId').combobox('reload', url);
			$('#hdcityId').combobox('clear');
			$('#hddistrictId').combobox('clear');
		}
		
		<%--获取区 --%>
		function getDistrict(rec){
			var url = '<%=basePath%>getDistrict?cityId=' rec.ID;
			$('#hddistrictId').combobox('loadData',[]);
			$('#hddistrictId').combobox('reload', url);
			$('#hddistrictId').combobox('clear');
		}
ui

0 人点赞