日期:2014-05-16  浏览次数:20398 次

extjs控制按钮是否显示
 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>控制按钮</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css" />
		<script type="text/javascript" src="extjs/ext-base.js" /></script>
		<script type="text/javascript" src="extjs/ext-basex.js" /></script>
		<script type="text/javascript" src="extjs/ext-all.js" /></script>
		<script type="text/javascript" src="extjs/ext-lang-zh_CN.js"></script>
		<script type="text/javascript">
		var _window;
		Ext.onReady(function() {
			Ext.onReady(function(){   
				      _window=new Ext.Window({   
				         title:"New Person",   
				         width:500,   
				         height:100,   
				         plain:true,   
				         items:[{   
				             baseCls:"x-plain",   
				             layout:"column",   
				             items:[{   
				                     columnWidth:.5  
				                 },   
				                 {   
				                     columnWidth:.5   
				                 }   
				             ]   
				         }],   
				         buttons:[   
				             {text:"OK",
					          value:2,
					          
				              handler:function(){  
					                 a(_window);
				              }},   
				             {text:"Cancel",
						      value:1,
						      disabled:false,
					          handler:function(){  
					            		 alert(_window.buttons[1].value);
					          }}    
				         ]   
				     });   
				     _window.show();   
				 }); 

		});
		getManager();
	     //取后台数据
	    function getManager(){//传一个部门id
	    	Ext.Ajax.request({
	  		   url: 'index4_json.jsp',
	  		   success: function(res){
	  		        //Ext.Msg.alert("提示消息",res.responseText);
	  		        var jsonResult = Ext.util.JSON.decode(res.responseText);
	  		        Ext.Msg.alert("提示",jsonResult.manager.name);
	  		        if('sammor'==jsonResult.manager.name){
	  		        	_window.buttons[1].disabled=true;
	  		        	_window.buttons[0].disabled=true;
		  		     }
	  	  		},
	  		   failure: function(){
	  		        Ext.Msg.alert("发送失败","失败");
	  	  		}
	  		});
	    }

		function a(_window){
			alert(_window.buttons[0].value);  
   		 	_window.buttons[0].disabled=true;
		}
</script>
	</head>
	<body>
	</body>
</html>

?

<%
String str= "{'manager':{'name':'sammor','userId':1002}}";
out.print(str);
%>
?

?