<%@ page language="java" pageEncoding="GBK"%>
<%
String contextPath = request.getContextPath();
String extPath = contextPath + "/js/ext-3.2.0";
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
<title>看得到么</title>
<link rel="stylesheet" type="text/css" href="<%=extPath %>/resources/css/ext-all.css">
<script type="text/javascript" src="<%=extPath %>/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="<%=extPath %>/ext-all.js"></script>
<script language="javascript" type="text/javascript">
Ext.onReady(function(){
var Job=Ext.data.Record.create([{name:'job'}]);
new Ext.Window(
{
height:450,
width:600,
layout:'form',
// plain:true,
title:"ceshide",
buttonAlign:'center',
defaults:'anchor:100%',
items:[
{
style:"padding:5px",
xtype:'form',
frame:true,
layout:"column",
items:[
{
layout:'form',
columnWidth:.5,
labelWidth:40,
defaultType:'textfield',
items:[
{
fieldLabel:"姓名1",
anchor:'90%'
},
{
fieldLabel:"日期",
xtype:"datefield",
format:'Y-m-d',
// value:'1985-04-11',
value:new Date(),
readOnly:true,
anchor:'90%',
listeners:{'blur':function(_df)
{
var _age = _df.ownerCt.findByType('textfield')[2];
// alert(_df.getValue().getFullYear());
_age.setValue(new Date().getFullYear()-_df.getValue().getFullYear()+1);
}}
},
{
fieldLabel:"年龄",
value:'20',
anchor:'90%',
readOnly:true
},
{
xtype:'combo',
fieldLabel:"性别",
displayField:'sex',
mode : 'local' ,
triggerAction:'all',
value:'男',
store:new Ext.data.SimpleStore({
fields:['sex'],
data:[['男'],['女']]
}),
anchor:'90%'
},
{
fieldLabel:"选择的",
anchor:'90%',
listeners:{'focus':function(){alert('123')}}
}
]
},
{
layout:'form',
columnWidth:.5,
labelWidth:40,
items:[
{
xtype:'textfield',
inputType:'image',
fieldLabel:'照片',
height:120,
width:200
}
]
}
]
},
{
xtype:'panel',
layout:'column',
frame:true,
items:[{
layout:'form',
columnWidth:.4,
labelWidth:45,
items:
{
xtype:'combo',
fieldLabel:'职位',
anchor:'100%',
displayField:'job',
mode : 'local' ,
triggerAction:'all',
listeners:{
select:function(_combo,_records,_index){
_combo['selectItem']= _records;
alert(_records.get("job"));
}
},
store:new Ext.data.SimpleStore({
fields:['job']
// ,
// data:[['程序员'],['主管'],['经理']]
})
}
},
{
columnWidth:.2,
style:'padding:0 0 0 10px;',
items:[{
xtype:'button',
text:'添加职位',
handler:function(){
var _window=this.ownerCt.ownerCt.ownerCt;
var _job = _window.findByType("combo")[1];
Ext.MessageBox.prompt('请输入职位名称','名称',
function(_btn,_text){
if(_btn =='ok')
{
var _store = this.store;
_store.insert(0,new Job({job:_text}));
this.setValue(_text);
_job['selectItem'] = this.store.getAt(0);
}
},_job);
}
}]
},
{
columnWidth:.2,
style:'padding:0 0 0 0px;',
items:[{
xtype:'button',
text:'修改职位',
handler:function(){
var _window=this.ownerCt.ownerCt.ownerCt;
var _job = _window.findByType("combo")[1];
if(_job['selectItem']!=null)
Ext.MessageBox.prompt('请输入修改后职位名称','职位名称',
function(_btn,_text){
if(_btn =='ok')
{
_job['selectItem'].set('job',_text);
this.setValue(_text);
}
},_job,false,_job.getValue());
}
}]
},
{
columnWidth:.2,
style:'padding:0 0 0 0px;',
items:[{
xtype:'button',
text:'删除职位',
handler:function(){
var _window=this.ownerCt.ownerCt.ownerCt;
var _job = _window.findByType("combo")[1];
if(_job['selectItem']!=null)
Ext.Msg.confirm("系统提示","你确定删除当前职位么?",function(_btn){
if(_btn=='yes')
{
try
{
this.store.remove(this['selectItem']);
}
catch( Error)
{}
if(this.store.getCount()!=0)
{
alert(this.store.getTotalCount());
this.setValue(this.store.getAt(0).get('job'));
this['selectItem']=this.store.getAt(0);
}
else
{
this.setValue("");
this['selectItem']=null;
}
}
},_job);
}
}]
}]
}
],
showLock:false,
listeners:{
'show':function(_window)
{
if(!window['showLock'])
{
_window.findByType("textfield")[5].getEl().dom.src='http://www.cnblogs.com/../js/ext-3.2.0/resources/images/default/grid/col-move-bottom.gif';
window['showLock']=true;
}}
},
buttons:[{text:'确定',handler:function(_window){
// alert (_window.ownerCt.findByType('button')[1].text);
}
},{text:'取消'}]
}).show();
});
</script>
</head>
<body>
<form id="form1">
<div id="Div1" >
</div>
</form>
</body>
</html>