freemarker二级联动

<#assign basePath="" />
<#assign xdttclist=xdttclist>
<#assign xdttclistTwo=xdttclistTwo>

选择表:
选择字段:
选择表:
选择字段:
var s1 = document.getElementById("exportOne");
var s2 = document.getElementById("exportTwo");
var s3 = document.getElementById("importOne");
var s4 = document.getElementById("importTwo");
var stationList = [];
var stationListTwo = []; 
function y(){
	 //获取二机组织信息
	 <#if xdttclist??>
	 	//一级组织
	 	<#list xdttclist as firstOrg>
	 		var station = new Object();
	 		station.tables = "${firstOrg.tables}";
	 		var areaList = [];
	 		//二级组织
	 		<#list firstOrg.columns as secondOrg>
	 			var secondOrg = new Object();
	 			secondOrg.name = "${secondOrg}";
	 			areaList.push(secondOrg);
	 			station.areaList = areaList;
	 		
	 		stationList.push(station);
	 	
	 
}; 

 function y2(){
	 //获取二级信息
	 <#if xdttclistTwo??>
	 	//一级组织
	 	<#list xdttclistTwo as firstOrgTwo>
	 		var stationTwo = new Object();
	 		stationTwo.tables = "${firstOrgTwo.tables}";
	 		var areaListTwo = [];
	 		//二级组织
	 		<#list firstOrgTwo.columns as secondOrgTwo>
	 			var secondOrgTwo = new Object();
	 			secondOrgTwo.name = "${secondOrgTwo}";
	 			areaListTwo.push(secondOrgTwo);
	 			stationTwo.areaListTwo = areaListTwo;
	 		
	 		stationListTwo.push(stationTwo);
	 	
	 	alert(stationListTwo.length);
	 
};  

function cg1(){
	var index = s1.selectedIndex;
	var indexTwo = s3.selectedIndex;
	var arrx = stationList[index];
	var arrxTwo = stationListTwo[indexTwo];
	s2.innerHTML = "";
	s4.innerHTML = "";
	for(var i = 0 ; i < arrx.areaList.length;i++){
		var text = arrx.areaList[i].name;
		
		s2.add(new Option(text,text)); 
	} 
	 for(var j = 0 ; j < arrxTwo.areaListTwo.length;j++){
		var textTwo = arrxTwo.areaListTwo[j].name;
		s4.add(new Option(textTwo,textTwo)); 
	}  
}
y();
y2();
cg1();

 

你可能感兴趣的:(freemarker二级联动)