今天写一个EasyUI 的ComboBox的2个下拉框联动,,主要是记录一些不知道的事情,本来是有一个BUG的,但是上传截图好烦,算了吧 。。。
js代码 $('#unitname').combobox({ | |
<td width="110px;">
<select id="ruleType" class="easyui-combobox" data-options="editable:false,panelHeight:'auto'"
style="display:block;width: 110px;height:32px;vertical-align: middle;">
<option selected value="">请选择</option>
<!-- <option value="0">地市</option> -->
<option value="1">终端类型</option>
<option value="3">城乡类型</option>
<option value="2">商圈类型</option>
<c:if test="${ident=='2' }">
<option value="4">县</option>
</c:if>
<!-- <option value="5">路线</option> -->
</select>
</td>
<td align="right" width="140px;">应用范围值:</td>
<td width="110px;">
<input id="applRange" type="text" class="easyui-combobox" name="applRange"
data-options="editable:false,panelHeight:'auto',valueField:'code',textField:'codeName',
panelHeight:170" style="width:110px;height:32px;vertical-align:middle;"/>
</td>
$('#ruleType').combobox({
onSelect: function (n,o) {
$('#applRange').combobox('clear');
var parentCode=$('#ruleType').combobox('getValue'); //n.ORG_CODE
if(parentCode!=null&&parentCode!=''){
var url=context+'/transPort/queryRuleType.do?parentorgcode='+parentCode;
$('#applRange').combobox('reload',url);
}else{
$('#applRange').combobox('loadData','');
}
}
});