![](/img/trans.png)
[英]Trigger an event after clicking browse button in file upload field Extjs
[英]In ExtJS, event fired before clicking opening a file upload field
我有Ext.form.field.File
, buttonOnly
屬性設置為true
。 我的問題是,在按下“瀏覽”按鈕后但在文件選擇器彈出之前,是否可以執行任何事件。 我希望選擇器不會在我想檢查的某些條件下彈出。 有什么建議嗎? 我試過show
和keydown
。 兩者都沒有執行。
是的,這有點棘手,但正是您要尋找的:
var file =Ext.create('Ext.form.field.File', {
name: 'photo',
fieldLabel: 'Photo',
labelWidth: 50,
msgTarget: 'side',
allowBlank: false,
anchor: '100%',
buttonText: 'Select Photo...',
renderTo:Ext.getBody(),
});
file.mon(file.triggerWrap, {
click : function(){
alert('yes you can');
file.disable();
Ext.defer(function(){file.enable();}, 10);
}
});
disable() 方法用於防止引發其他事件(這將阻止打開選擇文件的彈出窗口)
這里有一個工作示例: http : //jsfiddle.net/lontivero/GmAUt/2/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.