聚焦點離開時,您可以告訴某人如何防止點擊事件點擊組合點擊事件嗎?聚焦點擊事件後組合點火事件
2
A
回答
0
出現問題的原因組合強制選擇,即使用戶沒有實際選擇其他值的錯誤。
有幾種方法可以解決此問題。
- 使用選擇收聽,而不forceSelection
- 使用更改聽者forceSelection
兩種方式,用戶將不得不選擇從組合列表(這是可能的,爲什麼你的項目首先使用forceSelection配置)。
0
0
我在extjs 6.5.2 modern
同樣的問題。我正在使用和queryMode: 'remote'
,forceSelection: true
,自定義itemTpl
,我在使用select
事件選擇一個項目。 @ Jzf的解決方案沒有爲我工作(我也使用了change
事件),所以我不得不暫停focusleave
select
事件並恢復它在focusenter
。
這不是一個非常乾淨的解決方法,但它爲我的情況做了工作。 以下是我的combobox
的完整代碼:
{
xtype: 'combobox',
store: Ext.create('demo.store.search.SearchComboStore'),
valueField: 'id',
displayField: 'name',
queryMode: 'remote',
queryParam: 'name',
triggerAction: 'all',
allQuery: '',
minChars: 1,
forceSelection: true,
matchFieldWidth: false,
//[modern] added floated picker config here in order to set the minWidth property for the floated picker
floatedPicker: {
minWidth: (Ext.getBody().getWidth()/2)
},
itemTpl:
'<div class="ucResultsTable" style="width:' + (Ext.getBody().getWidth()/2) + 'px">' +
'<div class="ucResultsTableCell" style="width:15%"><b>{value1}</b></div>' +
'<div class="ucResultsTableCell" style="width:15%">{value2}</div>' +
'<div class="ucResultsTableCell" style="width:15%">{value3}</div>' +
'<div class="ucResultsTableCell" style="width:15%">{value4}</div>' +
'<div class="ucResultsTableCell" style="width:15%">{value5}</div>' +
'</div>',
listeners: {
select: function (comboBox, records, eOpts) {
var container = comboBox.up('app-container-panel');
container.fireEvent('selectComboItem', container, records.data);
},
//<Workaround>
//blur/focusleave is firing select event
//and changes the record selection
focusleave: function (comboBox) {
comboBox.suspendEvent('select');
},
focusenter: function (comboBox) {
comboBox.resumeEvent('select');
}
//</Workaround>
}
}
相關問題
- 1. Edittext點擊事件焦點
- 2. Gwt:如何不着火焦點後點擊事件?
- 3. 單擊焦點部件時的聚焦事件
- 4. 聚合物紙標籤點擊事件?
- 5. jquery.mobile「點擊」發射「焦點」事件
- 6. 點擊預防焦點事件
- 7. listView獲取焦點和點擊事件
- 8. 組合框控件的點擊事件
- 9. Winforms點擊事件不點火
- 10. Angular.js中焦點事件的單獨點擊事件
- 11. JCalendar焦點事件
- 12. iPad焦點事件
- 13. QLineEdit焦點事件
- 14. QLineEdit - 焦點事件
- 15. 失去焦點事件後按鈕點擊事件沒有觸發
- 16. 添加內嵌點擊事件後發生的點擊事件?
- 17. 綁定初始點擊事件(A)後點擊事件(B)導致事件B火災立即
- 18. jQuery的「後點擊」事件
- 19. prependto後點擊事件?
- 20. 失去焦點後無法獲得鼠標點擊事件
- 21. 點擊事件
- 22. 事件點擊
- 23. jquery聚焦事件
- 24. GTK聚焦事件
- 25. 凝聚點擊事件/功能
- 26. ExtJS的點擊事件,雙火
- 27. 點擊事件沒有開火! (backbone.js)
- 28. 。點擊事件似乎並不火
- 29. 局部視圖點擊事件不火
- 30. Click事件在聚合物紙的圖標按鈕不點火