ext 성시 연동 (네트워크 우수)

4086 단어 ext

<script language="javascript">
  Ext.onReady(function(){
  	
  })
 //    
function chooseFunction(){
	var id =document.getElementById("s1").value;
	var id2 =document.getElementById("s3").value;
	//alert(id);		
	Ext.Ajax.request({
				method:'post',
               	url: '../assessmodel/functionContent.do?modelId='+id+'&sysId='+id2,                           
               	success: function(json){ 
					  var aa = json.responseText;
					  var data = eval('('+aa+')');
					  var bb=data.rows;
					  var sele = document.getElementById("s2");
					  sele.innerHTML = "";
					  var option2 = document.createElement('option');
					  	option2.value ="";
					  	option2.text= " ";
					  	option2.selected="selected";
					  	sele.add(option2);		
					  for(var i=0;i<bb.length;i++){
					  	var option = document.createElement('option');
					  	option.value = bb[i].id;
					  	option.text= bb[i].name;
					  	sele.add(option);					  	
					  }	 
				},
               failure : function() { 
                      alert(" "); 
        	  } 
           });	
    // div
    Ext.get('assessModel_div').load({
		url:'../assessmodel/assessModelList.do?id='+id,
		text: "Loading ...",
		callback:function(){
		}
	});       				
}


</script>
<% 
	List modellist = (List)request.getAttribute("tawwpmodellist"); // 
	List sysTypeList = (List)request.getAttribute("sysTypeList"); 
 %>
<form name="assessModelAdd" method="post"action="'>
	<table class="formTable">
	
				
		<tr>
			<td class="label"  > </td>
			<td>	
				<select name="sysId" size="1" style="width: 6.8cm;" id="s3" onchange="javascript:chooseFunction();">	
					 <option value=""> </option>                 			 
					<option value="1">11</option>
					<option value="2">22</option>			

페이지에서 받은 값을 처리하는 다른 방법:
// 
function getSelectStandareFun(functionId,standareId){
	Ext.Ajax.request({
		url: 'standarelistajax.do',
		method: 'post',
		success: function(response){
			var returnString = response.responseText;
			if(returnString!=""&&returnString!="null") {
				var responseArray = Ext.util.JSON.decode(returnString);
				var strHtml = "<select name='standareId' id='standareId'  class='select'   >";
					strHtml += "<option value=''> </option>";
					for ( var i = 0; i < responseArray.length; i++) {
						var code = responseArray[i].standareId;
						var name = responseArray[i].cnName;
						strHtml += "<option value='" + code + "'>"
								+ name + "</option>";
					}
					strHtml += "</select>";
					Ext.getDom('standareDiv').innerHTML = strHtml;
					if(standareId!=null&&standareId!=""){
						var standareObj = document.getElementById("standareId");
						for(var i=0;i<standareObj.options.length;i++){
							if(standareObj.options[i].value == standareId){
								standareObj.options[i].selected = true;
								break;
							}
						}
					}
			}else{
				Ext.Msg.show({ msg: ' !', buttons: Ext.Msg.OK });
			}	
		},
		failure: function(){
			Ext.Msg.show({ msg: '   !', buttons: Ext.Msg.OK });
		},
		params: { 
			functionId:functionId
		}
	});
}

좋은 웹페이지 즐겨찾기