easyui combobox两种联动方法与导致ie6崩溃问题


$(function(){
var stEventType = $('#stEventType').combobox({
url:'sub_template/code_json.jsp?type=EVENT_TYPE',
editable:false,
valueField:'tid',
textField:'text',
required:true,
onSelect:function(record){
stEventName.combobox({
url:'sub_template/code_json.jsp?type='+record.tid,
editable:false,
valueField:'tid',
textField:'text',
required:true
}).combobox('clear');
}

});
var sub_value = $('#stEventType').combobox('getValue');
if(sub_value==''){
sub_value='EVENT_TYPE_1';
}
var stEventName = $('#stEventName').combobox({
url:'sub_template/code_json.jsp?type='+sub_value,
editable:false,
valueField:'tid',
textField:'text',
required:true
});
$('#stDiscoverUnit').combobox({
editable:false,
url:'sub_template/unit_json.jsp?streetId=<%=(String)session.getAttribute("streetId")%>&typestr=1~2~-1',
valueField:'text',
required:true,
textField:'text'
});
$("#type_div").show();
$("#name_div").show();
});



<div id="type_div" style="display:none">
<input id="stEventType" type="text" style="width:155px" value=""/>
</div>
</td>
<td align="center" valign="middle" class="table_title" nowrap="nowrap" >
<font color="red">*</font>事件名称</td>
<td class="table_content">
<div id="name_div" style="display:none">
<input id="stEventName" type="text" style="width:155px" value=""/>
</div>


用于combobox的联动 div一般情况下是可以不需要的 这里加上主要是因为数据回显的时候js加载较慢 防止数据显示select value出来

此方法在项目中同一页面js过多的情况下会导致ie6崩溃
于是采用第二种方法

$(function(){
var type_select = $('#stEventType').combobox({
url:'sub_template/code_json.jsp?type=EVENT_TYPE',
editable:false,
valueField:'tid',
textField:'text',
onSelect:function(record){
$('#stEventName').combobox('clear');
$('#stEventName').combobox('reload','sub_template/code_json.jsp?type='+record.tid);
}
});
var sub_select = $('#stEventName').combobox({
disabled:false,
url:'sub_template/code_json.jsp?type=EVENT_TYPE_1',
valueField:'tid',
textField:'text'
});
});
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值