jquery easyui combobox 二级联动

安奇
2023-12-01

$(function(){
        var provinceId = $('#provinceId').combobox({
            url:'${pageContext.request.contextPath}/region/province/json.htm',
            editable:false,
            valueField:'id',
            textField:'name',
            onSelect:function(record){
                //刷新数据,重新读取省份下的城市,并清空当前输入的值
                cityId.combobox({
                    disabled:false,
                    url:'${pageContext.request.contextPath}/region/city/'+record.id+'/json.htm',
                    valueField:'id',
                    textField:'name'
                }).combobox('clear');
            }
        });
        var cityId = $('#cityId').combobox({
            disabled:true,
            url:'${pageContext.request.contextPath}/region/city/'+provinceId.val()+'/json.htm',
            valueField:'id',
            textField:'name'
        });
});

 类似资料: