ExtJs日期选择器侦听器
我的表格上有日期字段:ExtJs日期选择器侦听器,extjs,extjs3,Extjs,Extjs3,我的表格上有日期字段: var intForm = new Ext.FormPanel({ width: 350, autoHeight: true, bodyStyle: 'padding: 10px 10px 10px 10px;', labelWidth: 70, defaults: { anchor: '95%', allowBlank: fal
var intForm = new Ext.FormPanel({
width: 350,
autoHeight: true,
bodyStyle: 'padding: 10px 10px 10px 10px;',
labelWidth: 70,
defaults: {
anchor: '95%',
allowBlank: false,
msgTarget: 'side'
},items:[{
xtype:'datefield',
fieldLabel: 'Выберете дату',
name: 'intDate',
anchor:'80%',
maxValue: new Date(),
listeners:{
'change': function(this,newValue,oldValue){
alert('newValue');
}
}
}]
});
但当我启动应用程序时,会出现错误:
SyntaxError: missing formal parameter
'change': function(this,newValue,oldValue){
当我创建这样的日期字段时,我不能使用侦听器,我要使用变量来创建日期字段吗?您不能使用
此
作为参数名,请使用类似self
或me
的其他名称
'change': function(self,newValue,oldValue){
如果出现语法错误,则不能将
此
用作参数名称将其更改为字段
或任何其他名称
var intForm = new Ext.FormPanel({
width : 350,
autoHeight : true,
bodyStyle : 'padding: 10px 10px 10px 10px;',
labelWidth : 70,
defaults : {
anchor : '95%',
allowBlank : false,
msgTarget : 'side'
},
items : [{
xtype : 'datefield',
fieldLabel : 'Выберете дату',
name : 'intDate',
anchor : '80%',
maxValue : new Date(),
listeners : {
'change' : function(field, newValue, oldValue) {
alert('newValue');
}
}
}]
});