JS实现二级级联

把数据转成JSON 数据

private
 String getCurrencyAccountJson(Map<String, List<CrdCurrentAcctMaster>> accountCCY){
       		Set<String> set = accountCCY.keySet();new JSONObject();       		JSONObject jsonObj =for (String str : set) {           			List<CrdCurrentAcctMaster> reportTypeList = accountCCY.get(str);           			JSONObject typeJson =new JSONObject();for (int i=0; i<reportTypeList.size();i++){               				CrdCurrentAcctMaster reportType = reportTypeList.get(i);               				typeJson.put(i,reportType.getAcctCcy()+"_"+reportType.getAcctNum());                   			}                   			jsonObj.put(str, typeJson);                   		}return jsonObj.toString();                       	

JS 函数控制显示:

function showAccoutNum(){var accountccy = $.parseJSON('${accountCurrencyList}');
var oneOffValuationDate = $("#oneOffValuationDate").val();var createType = $("#createType").val();if(oneOffValuationDate == ""){                                          		$("#accountCurrency option").each(function(i){                                              			$(this).remove();                                                  		});                                                  		$("#accountCurrency").append("<option value=''>ALL</option>");return ;                                                          	}else{//alert("oneOffValuationDate="+oneOffValuationDate);//remove the old                                                                      		$("#accountCurrency option").each(function(i){                                                                          			$(this).remove();                                                                              		});                                                                              		$("#accountCurrency").append("<option value=''>ALL</option>");if (accountccy[oneOffValuationDate] == undefined){                                                                                      			alert("this one-off valueation Date have no account num and ccy!");return false;                                                                                              		}//append the newfor(var i=0;1;i++){// ccyacount = ccy_numvar ccyaccount = accountccy[oneOffValuationDate][i];//alert(ccyaccount);if ( ccyaccount == undefined){break;                                                                                                                          		}var arrayCCY = ccyaccount.split("_");//alert(arrayCCY[0]+"---"+arrayCCY[1]);if (createType == 'edit' || createType == 'exist'){var accNum = $("#accountNum").val();if (accNum.indexOf(arrayCCY[1]) != -1){                                                                                                                                              				$("#accountCurrency").append("<option value='"+arrayCCY[1]+"' currencyValue='"+accountccy[oneOffValuationDate]+"' selected>"+ccyaccount+"</option>");                                                                                                                                                  			}                                                                                                                                                  		}else{                                                                                                                                                      			$("#accountCurrency").append("<option value='"+arrayCCY[1]+"' currencyValue='"+accountccy[oneOffValuationDate]+"'>"+ccyaccount+"</option>");                                                                                                                                                          		}                                                                                                                                                          	}                                                                                                                                                          	}}

转载于:https://my.oschina.net/u/1448718/blog/323112

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值