//combobox的onLoadSuccess,onChange,onSelect事件
省:<input id="province" style="width: 110px;" />
市:<input id="city" style="width: 110px;"/>
县区:<input id="county" style="width: 110px;" />
$(document).ready(function(){
//行政区域码var re = $ht.form.ajaxS(请求地址,null,"json");
if(re =="noRight"){
return;
}
var list = new Array();
list.push({ "id":"-1", "name": "全部" });
if(re.list!=null&&re.list!='null'){
list.push.apply(list,re.list);
}
$('#province').combobox({
data:list,
editable:false, //不可编辑状态
cache: false,
// panelHeight: 'auto',//自动高度适合
valueField:'id',
textField:'name',
onLoadSuccess:function(){
$('#province').combobox('select', list[0].id);
}
});
$("#province").combobox({
onSelect:function(n,o){
var province = $('#province').combobox('getValue');
var data={id:province};
var re = $ht.form.ajaxS(请求地址,data,"json");
if(re =="noRight"){
return;
}
var list = new Array();
list.push({ "id":"-1", "name": "全部" });
if(re.list!=null&&re.list!='null'){
list.push.apply(list,re.list);
}
$('#city').combobox({
data:list,
editable:false, //不可编辑状态
cache: false,
// panelHeight: 'auto',//自动高度适合
valueField:'id',
textField:'name',
onLoadSuccess:function(){
$('#city').combobox('select', list[0].id);
}
});
cityfun();
}
});
function cityfun(){
$("#city").combobox({
onChange:function(n,o){
var city = $('#city').combobox('getValue');
var data={id:city};
var re = $ht.form.ajaxS(请求地址,data,"json");
if(re =="noRight"){
return;
}
var list = new Array();
list.push({ "id":"-1", "name": "全部" });
if(re.list!=null&&re.list!='null'){
list.push.apply(list,re.list);
}
$('#county').combobox({
data:list,
editable:false, //不可编辑状态
cache: false,
//panelHeight: 'auto',//自动高度适合
valueField:'id',
textField:'name'
});
$('#county').combobox('select', list[0].id);
}
});
}
});