当前位置:编程学习 > JAVA >>

jquery easyui combobox 值的判断和处理,推敲了半天才搞通的,贴出来记一下

//如果是有代理商退货,会显示退货代理商和退货品牌  
            if(${type==2}){ 
                var bid0 = $('#orderReturnForm').find('input[name=bid]'); 
                var agencyid = $('#orderReturnForm').find('input[name=agencyid]'); 
                 
                var agencyidCombobox = agencyid.combobox({ 
                    url : '${pageContext.request.contextPath}/dls/agencyAction!noAuth_MyAgencyJson.html', 
                    valueField : 'id',  
                    textField : 'username', 
                    multiple : false, 
                    editable : false, 
                    panelHeight : 'auto', 
                    onSelect : function(){ 
                        var agencyvalue = agencyid.combobox("getValue"); 
                        var bid0Combobox = bid0.combobox({ 
                        url : '${pageContext.request.contextPath}/spgl/brandAction!noAuth_comboboxAgencyBrand.html?agencyid='+agencyvalue, 
                        valueField : 'id', 
                        textField : 'name', 
                        multiple : true, 
                        editable : true, 
                        onLoadSuccess : function() { 
                            parent.$.messager.progress('close'); 
                            } 
                        });  
                        $("#bid").combobox('showPanel'); 
                    } 
                }); 
            } 

//如果是有代理商退货,会显示退货代理商和退货品牌
   if(${type==2}){
    var bid0 = $('#orderReturnForm').find('input[name=bid]');
    var agencyid = $('#orderReturnForm').find('input[name=agencyid]');
    
    var agencyidCombobox = agencyid.combobox({
     url : '${pageContext.request.contextPath}/dls/agencyAction!noAuth_MyAgencyJson.html',
     valueField : 'id',
     textField : 'username',
     multiple : false,
     editable : false,
     panelHeight : 'auto',
     onSelect : function(){
      var agencyvalue = agencyid.combobox("getValue");
      var bid0Combobox = bid0.combobox({
      url : '${pageContext.request.contextPath}/spgl/brandAction!noAuth_comboboxAgencyBrand.html?agencyid='+agencyvalue,
      valueField : 'id',
      textField : 'name',
      multiple : true,
      editable : true,
      onLoadSuccess : function() {
       parent.$.messager.progress('close');
       }
      }); 
      $("#bid").combobox('showPanel');
     }
    });
   }

 

 

 

 


 

 
//判断仓库是否为空,如果为空则显示仓库下拉框;如果非空则把仓库给隐藏域  
            if($("#rid")!=null&&$("#rid").combobox("getValues")!=null&&$("#rid").combobox("getValues")!=""){ 
                var rid = $("#rid").combobox("getValues"); 
                $(".rid").attr("name","rid"); 
                $(".rid").attr("value",rid); 
            }else{ 
                //parent.sy.messagerConfirm('未选择退货仓库', '请选择要退货仓库!');  
                $("#rid").combobox('showPanel'); 
                return; 
            } 
             
            //有代理商退货的情况  
            if(${type==2}){ 
                //判断代理商是否为空,不为空则处理品牌,为空则显示代理商下拉框  
                if($("#agencyid")!=null&&$("#agencyid").combobox("getValues")!=null&&$("#agencyid").combobox("getValues")!=""){ 
                    if($("#bid")!=null&&$("#bid").combobox("getValues")!=null&&$("#bid").combobox("getValues")!=""){ 
                        var bid0 = $('#bid').combobox("getValues"); 
                        $(".bids").attr("name","bids"); 
                        $(".bids").attr("value",bid0); 
                    }else{ 
                        $("#bid").combobox('showPanel'); 
                        return; 
                    } 
                }else{ 
                    $("#agencyid").combobox('showPanel'); 
                    return; 
                } 
             
            } 
             

//判断仓库是否为空,如果为空则显示仓库下拉框;如果非空则把仓库给隐藏域
   if($("#rid")!=null&&$("#rid").combobox("getValues")!=null&&$("#rid").combobox("getValues")!=""){
    var rid = $("#rid").combobox("getValues");
    $(".rid").attr("name","rid");
    $(".rid").attr("value",rid);
   }else{
    //parent.sy.messagerConfirm('未选择退货仓库', '请选择要退货仓库!');
    $("#rid").combobox('showPanel');
    return;
   }
   
   //有代理商退货的情况
   if(${type==2}){
    //判断代理商是否为空,不为空则处理品牌,为空则显示代理商下拉框
    if($("#agencyid")!=null&&$("#agencyid").combobox("getValues")!=null&&$("#agencyid").combobox("getValues")!=""){
     if($("#bid")!=null&&$("#bid").combobox("getValues")!=null&&$("#bid").combobox("getValues")!=""){
      var bid0 = $('#bid').combobox("getValues");
      $(".bids").attr("name","bids");
      $(".bids").attr("value",bid0);
     }else{
      $("#bid").combobox('showPanel');
      return;
     }
    }else{
     $("#agencyid").combobox('showPanel');
     return;
    }
   
   }
   

 

补充:web前端 , JavaScript ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,