【发布时间】:2015-08-13 07:55:19
【问题描述】:
我想要一个简单的 Extjs 文档上传面板。我用了这个example available on Sencha Docs。我期待这样的事情
但是当我实现与它相同的示例时,我的面板显示如下(保存图像是由于我正在尝试的东西)。
问题在于选择文件按钮。我知道 sencha 示例正在使用某种 CSS,但我试图通过 css 将 Image 作为背景,但这也无济于事(如果我在 Button 配置中设置“icon”属性,即使如此,按钮仍保持相同大小)。
这是我的代码
{
xtype: 'form',
padding: '5 5 5 5',
flex: 1,
frame: false,
border: false,
title: 'File Upload Form',
bodyPadding: '50 10 0',
defaults: {
anchor: '100%',
allowBlank: false,
msgTarget: 'side',
labelWidth: 50
},
items: [{
xtype: 'textfield',
fieldLabel: 'Name'
},{
xtype: 'filefield',
id: 'form-file',
emptyText: 'Select an image',
fieldLabel: 'Photo',
name: 'photo-path',
buttonText: '',
buttonConfig: {
iconCls: "background:url(http://simonwai.com/images/save_icon.gif) no-repeat !important; border:none;"
//icon: "http://simonwai.com/images/save_icon.gif",
}
}],
buttons: [{
//text: 'Save',
icon: "http://simonwai.com/images/save_icon.gif",
handler: function(){
/*var form = this.up('form').getForm();
if(form.isValid()){
form.submit({
url: 'file-upload.php',
waitMsg: 'Uploading your photo...',
success: function(fp, o) {
msg('Success', tpl.apply(o.result));
}
});
}*/
}
},{
text: 'Reset',
handler: function() {
//this.up('form').getForm().reset();
}
}]
}
请帮忙。
【问题讨论】:
标签: extjs extjs4 extjs4.2 sencha-cmd filefield