ext-- 양식 초기화

4035 단어 ext
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title> </title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <link rel="stylesheet" type="text/css" href="../ext/resources/css/ext-all.css">
	<script type="text/javascript" src="../ext/adapter/ext/ext-base.js"></script>
	<script type="text/javascript" src="../ext/ext-all.js"></script>
	<script type="text/javascript">
		Ext.onReady(function(){
			var f = new Ext.form.FormPanel(
				{
					title:" ",
					url:"",
					method:"post",
					frame:true,
					width:300,
					autoHeight:true,
					renderTo:"f",
					labelAlign:"right",
					labelWidth:65,
					defaultType:"textfield",
					items:[
						{
							xtype:"textfield",
							name:"username",
							fieldLabel:" ",
							width:200
						},
						{
							xtype:"textfield",
							inputType:"password",
							name:"password",
							fieldLabel:" ",
							width:200
						},
						{
							xtype:"datefield",
							name:"birthday",
							fieldLabel:" ",
							format:"Y-m-d",
							width:150
						},
						{
							xtype:"radiogroup",
							name:"sex",
							fieldLabel:" ",
							width:100,
							items:[
								{
									xtype:"radio",
									name:"sex",
									boxLabel:" ",
									inputValue:" "
								},
								{
									xtype:"radio",
									name:"sex",
									boxLabel:" ",
									inputValue:" "
								}
							]
						}
					],
					buttonAlign:"center",
					buttons:[
						 {
						 	text:" "
						 },
						 {
						 	text:" ",
						 	handler:function(){
						 		//  。
						 		var json = {
						 			username:"test",
						 			password:"123",
						 			birthday:"1987-03-06",
						 			sex:" "
						 		};
						 		f.getForm().setValues(json);
						 	}
						 },
						 {
						 	text:" ",
						 	handler:function(){
						 		
						 		var reader = new Ext.data.JsonReader({},[
						 			{
						 				name:"username",
						 				type:"string",
						 				mapping:"username"
						 			},
						 			{
						 				name:"password",
						 				type:"string",
						 				mapping:"password"
						 			},
						 			{
						 				name:"birthday",
						 				type:"string",
						 				mapping:"birthday"
						 			},
						 			{
						 				name:"sex",// 
						 				type:"string",
						 				mapping:"sex"//json key
						 			}]);
						 		f.getForm().reader = reader;// 
						 		f.load({url:"initForm!getInitData.action"});// 
						 	}
						 }	
					]
				}
			);
		});
	</script>
  </head>
  
  <body>
	<div id="f" align="center"></div>
  </body>
</html>

좋은 웹페이지 즐겨찾기