`

Ext获取年份

    博客分类:
  • Ext
 
阅读更多

第一种情况:

代码:

items:[
{
columnWidth : .44,
labelWidth:80,
emptyText: '请选择年度',
layout : 'form',
items : [
new Ext.form.DateField({
fieldLabel : '招生年度',
id : 'input1',
name :'TZTM_YEAR',
width : 160,
//value:sys.sysDate,
readOnly :true,
format:'Y',
allowBlank : true
})
]
}
]

界面如图:

如果要获取它的值,方法:1.var input1=Ext.getCmp("input").getValue().format("Y");

2.$("input").value

3.在Items中加value:sys.sysDate,

4.$value("input").format("Y")

 

第二种情况:

<html>
<head>
<title>Ext JS 3.3 Examples</title>

<link rel="stylesheet" type="text/css" href="resources/css/ext-all.css" />


<script type="text/javascript" src="adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-all.js"></script>
<script type="text/javascript">
Form = Ext.extend(Ext.form.FormPanel,{
constructor:function(){
Form.superclass.constructor.call(this,{
title:"测试",
width:300,
height:100,
defaults:{
xtype:"datefield"
},
items:{
fieldLabel : '入学起止时间',
id:'ENTRANCEDATEEND1',
name:"ENTRANCEDATEEND1",
format : 'Ymd',
//alue:sys.sysDate,
//readOnly :true,
//
editable:false,
//allowBlank :false,
width : 160
},
buttons:[{
text:"确定",
handler:function(){
var values = this.getForm().getValues();
var _r = new Ext.data.Record(values);
alert(_r.get("ENTRANCEDATEEND1"));
},
scope:this
}]

});
}
})
Ext.onReady(function(){
var _form = new Form();
_form.render(Ext.getBody());
});
</script>
</head>
<body>

 

</body>
</html>

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics