Extjs4.2关于formPanel的items绑定监听的问题

静思长远 静思长远 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
小弟有一事费解,在formpanel加载的时候会将'firstName' 加载到item中,但是item中我增加了 change事件,这样就导致在加载的时候触发了change事件,如何在加载的时候屏蔽掉change事件?当我手动输入的时候再触发change。是否有可能实现?

个人怀疑其实extjs4.2的change事件没有问题,只不过formpanel的逻辑是创建完标签后LoadRecord赋值,将值为空的标签赋值为store的值。。



代码如下:Ext.onReady(function(){

Ext.define('Users',{
extend:'Ext.data.Model',
fields:[
{type:'string',name:'firstName'},
{type:'string',name:'lastName'},
{type:'int',name:'age'},
{type:'string',name:'eyeColor'}
]

});

var userm=Ext.create('Users',{
firstName:'222',
lastName:'333',
age:15,
eyeColor:'yellow'

});

var panel=Ext.create('Ext.form.FormPanel',{
title:'TTTTTTT',
width:300,
height:400,
renderTo:"ege",
bodyStyle:'padding:5px 5px 5px 5px',
id:'ege',
items:[
{
xtype: 'textfield' ,
id:'firstName',
name:'firstName',
text:"123123123123",
width:220,
height:60,
layout: 'auto',
listeners:{
'change':function(e,t,options) {
fn_jt(e,t,options);
}
}


],listeners: {
beforerender: { fn: function () {
this.suspendEvent(true);
}
},
afterrender:{
fn: function () {
this.resumeEvent(true);
}

}
}

});
panel.getForm().loadRecord(userm);
});
...全文
评论
收藏 已收藏
分享
返回顶部
静思长远
JavaScript 87,983 成员 224,681 内容