我测试了所有的操作,添加,删除,点击等等。只有在侦听器中触发的change事件:(
这是在我删除toField中的项时发生的,我真的希望在将item添加到toField时触发事件(只需双击fromField项)。
我该如何捕捉这个事件?
谢谢。
var documentSelector = Ext.create('Ext.ux.form.ItemSelector', {
name: 'documentSelector',
fieldLabel: 'Document',
anchor: '100%',
store: a,
valueField: "name",
displayField: "name",
allowBlank: false,
msgTarget: 'side',
listeners: {
added: function(obj, event) {
console.log("added");
},
change: function(obj, event) {
console.log("change");
},
removed: function(obj, event) {
console.log("removed");
},
blur: function(obj, event) {
console.log("blur");
},
click: function(obj) {
console.log('click');
},
select: function(obj) {
console.log('select');
}
}
});发布于 2017-10-04 21:11:24
事件blur和click永远不会触发,因为它们不是itemSelector上的事件。ItemSelector的事件被记录为这里 for extjs(4.07)。
您只需使用更改事件并根据更改事件进行操作。/** * @event change * Fires when a user-initiated change is detected in the value of the field. * @param {Ext.form.field.Field} this * @param {Object} newValue The new value * @param {Object} oldValue The original value */
添加处理程序以根据newValue更改事件,或将newValue与oldValue进行比较。
https://stackoverflow.com/questions/8413429
复制相似问题