我有一个模糊事件的简单组合框。模糊事件目前有一个要求测试目的的警报。ExtJS 4 - 组合框模糊事件被激发两次
的问题是,这种模糊的事件会得到如下触发了两次:
如果光标在此组合框和用户按下“Tab”键,由于该组合框失去焦点 - >模糊事件被解雇。
一旦组合框丢失焦点,如果用户在屏幕上的任意位置单击鼠标,则模糊事件会再次被触发。
有没有反正这个模糊事件可以只触发一次?
下面是完整的代码我使用:
<html>
<head>
<title>Test Page</title>
<link rel="stylesheet" type="text/css" href="ext-4.0.2a/resources/css/ext-all.css">
<script type="text/javascript" src="ext-4.0.2a/bootstrap.js"></script>
<script type='text/javascript'>
Ext.onReady(function(){
Ext.define("Post", {
extend: 'Ext.data.Model',
fields: [
{name: 'id', mapping: 'post_id'},
{name: 'title', mapping: 'topic_title'},
{name: 'topicId', mapping: 'topic_id'},
{name: 'author', mapping: 'author'},
{name: 'lastPost', mapping: 'post_time', type: 'date', dateFormat: 'timestamp'},
{name: 'excerpt', mapping: 'post_text'}
]
});
ds = Ext.create('Ext.data.Store', {
pageSize: 10,
proxy: {
type: 'jsonp',
url : 'http://www.sencha.com/forum/topics-remote.php',
reader: {
type: 'json',
root: 'topics',
totalProperty: 'totalCount'
}
},
model: 'Post'
});
panel = Ext.create('Ext.panel.Panel', {
renderTo: Ext.getBody(),
title: 'Search the Ext Forums',
width: 600,
bodyPadding: 10,
layout: 'anchor',
items: [{
xtype: 'combo',
store: ds,
displayField: 'title',
fieldLabel:'Blur Test',
listeners:{
blur:function(){
alert('1');
}
}
}, {
xtype: 'component',
style: 'margin-top:10px',
html: 'Live search requires a minimum of 4 characters.'
}]
});
});
</script>
</head>
<body>
</body>
</html>
感谢提前的帮助。 PS:我使用ExtJS版本4.0.2a并在Firefox,IE9和IE8中检查了此行为。他们都是两次发射事件。但是,当在Chrome中选中时,该事件只会被触发一次。
http://jsfiddle.net/ZkqP8/我似乎无法复制该问题。您使用的是什么浏览器和ExtJS 4版本? – rwilliams
感谢职位RWilliams。我用版本和浏览器详细信息更新了我的问题。另外,我查看了你和你分享的小提琴链接,发现模糊事件甚至没有被解雇。你的情况只发一次吗?对我来说,它在小提琴环节根本没有开火。 – netemp
我知道你使用的ExtJS版本4,但它是4.0.2,4.0.2a,4.0.6等etc – rwilliams