JavaScript
Run Code
Open in Fiddle
Ext.application({ name : 'Fiddle', launch : function () { Ext.create('Ext.form.field.File', { fieldLabel : 'Attach Items', buttonText : 'Browse Items', labelAlign : 'top', labelSeparator : '', reference : 'uploadMail', renderTo : Ext.getBody(), margin : 32, listeners : { afterrender : this.onAfterRenderFileField } }); }, onAfterRenderFileField : function (cmp) { //you could just use the cmp passed however since you're asking // in your controller // //recommend using reference to get the component from the view // controller but commented out since running directly in the // launch and using ComponentQuery // // var me = this, // uploadMail = me.lookupReference('uploadMail'); var uploadMail = Ext.ComponentQuery.query('[reference=uploadMail]')[0]; if (!Ext.isEmpty(uploadMail)) { //disable the browse button // var fileButton = uploadMail.getTrigger('filebutton'); if (!Ext.isEmpty(fileButton)) { fileButton.component.disable(); } } } });