<!DOCTYPE html>
|
<html>
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<title>The source code</title>
|
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
|
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
|
<style type="text/css">
|
.highlight { display: block; background-color: #ddd; }
|
</style>
|
<script type="text/javascript">
|
function highlight() {
|
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
|
}
|
</script>
|
</head>
|
<body onload="prettyPrint(); highlight();">
|
<pre class="prettyprint lang-js"><span id='Ext-form-field-FileButton'>/**
|
</span> *
|
*/
|
Ext.define('Ext.form.field.FileButton', {
|
extend: 'Ext.button.Button',
|
alias: 'widget.filebutton',
|
|
<span id='Ext-form-field-FileButton-property-childEls'> childEls: [
|
</span> 'btnEl', 'btnWrap', 'btnInnerEl', 'btnIconEl', 'fileInputEl'
|
],
|
|
<span id='Ext-form-field-FileButton-property-inputCls'> inputCls: Ext.baseCSSPrefix + 'form-file-input',
|
</span>
|
<span id='Ext-form-field-FileButton-cfg-cls'> cls: Ext.baseCSSPrefix + 'form-file-btn',
|
</span>
|
<span id='Ext-form-field-FileButton-cfg-preventDefault'> preventDefault: false,
|
</span>
|
<span id='Ext-form-field-FileButton-cfg-renderTpl'> renderTpl: [
|
</span> '<span id="{id}-btnWrap" class="{baseCls}-wrap',
|
'<tpl if="splitCls"> {splitCls}</tpl>',
|
'{childElCls}" unselectable="on">',
|
'<span id="{id}-btnEl" class="{baseCls}-button">',
|
'<span id="{id}-btnInnerEl" class="{baseCls}-inner {innerCls}',
|
'{childElCls}" unselectable="on">',
|
'{text}',
|
'</span>',
|
'<span role="img" id="{id}-btnIconEl" class="{baseCls}-icon-el {iconCls}',
|
'{childElCls} {glyphCls}" unselectable="on" style="',
|
'<tpl if="iconUrl">background-image:url({iconUrl});</tpl>',
|
'<tpl if="glyph && glyphFontFamily">font-family:{glyphFontFamily};</tpl>">',
|
'<tpl if="glyph">&#{glyph};</tpl><tpl if="iconCls || iconUrl">&#160;</tpl>',
|
'</span>',
|
'</span>',
|
'</span>',
|
'<input id="{id}-fileInputEl" class="{childElCls} {inputCls}" type="file" size="1" name="{inputName}">'
|
],
|
|
<span id='Ext-form-field-FileButton-method-getTemplateArgs'> getTemplateArgs: function(){
|
</span> var args = this.callParent();
|
args.inputCls = this.inputCls;
|
args.inputName = this.inputName;
|
return args;
|
},
|
|
<span id='Ext-form-field-FileButton-method-afterRender'> afterRender: function(){
|
</span> var me = this;
|
me.callParent(arguments);
|
me.fileInputEl.on('change', me.fireChange, me);
|
},
|
|
<span id='Ext-form-field-FileButton-method-fireChange'> fireChange: function(e){
|
</span> this.fireEvent('change', this, e, this.fileInputEl.dom.value);
|
},
|
|
<span id='Ext-form-field-FileButton-method-createFileInput'> /**
|
</span> * @private
|
* Creates the file input element. It is inserted into the trigger button component, made
|
* invisible, and floated on top of the button's other content so that it will receive the
|
* button's clicks.
|
*/
|
createFileInput : function(isTemporary) {
|
var me = this;
|
me.fileInputEl = me.el.createChild({
|
name: me.inputName,
|
id: !isTemporary ? me.id + '-fileInputEl' : undefined,
|
cls: me.inputCls,
|
tag: 'input',
|
type: 'file',
|
size: 1
|
});
|
me.fileInputEl.on('change', me.fireChange, me);
|
},
|
|
<span id='Ext-form-field-FileButton-method-reset'> reset: function(remove){
|
</span> if (remove) {
|
this.fileInputEl.remove();
|
}
|
this.createFileInput(!remove);
|
},
|
|
<span id='Ext-form-field-FileButton-method-restoreInput'> restoreInput: function(el){
|
</span> this.fileInputEl.remove();
|
el = Ext.get(el);
|
this.el.appendChild(el);
|
this.fileInputEl = el;
|
},
|
|
<span id='Ext-form-field-FileButton-method-onDisable'> onDisable: function(){
|
</span> this.callParent();
|
this.fileInputEl.dom.disabled = true;
|
},
|
|
<span id='Ext-form-field-FileButton-method-onEnable'> onEnable : function() {
|
</span> this.callParent();
|
this.fileInputEl.dom.disabled = false;
|
}
|
});
|
</pre>
|
</body>
|
</html>
|