ExtJS文件上传字段don';不能正确显示
我正在使用ExtJS3.4,我想在我的应用程序中使用fileupload。我的代码和文件上传字段屏幕截图如下所示。显示fileupload字段时出现问题,我无法解决此错误。有人能帮忙吗ExtJS文件上传字段don';不能正确显示,extjs,file-upload,extjs3,Extjs,File Upload,Extjs3,我正在使用ExtJS3.4,我想在我的应用程序中使用fileupload。我的代码和文件上传字段屏幕截图如下所示。显示fileupload字段时出现问题,我无法解决此错误。有人能帮忙吗 var uploadFormPanel = new Ext.FormPanel({ fileUpload : true, autoHeight : true, height : 200, bodyStyle : 'padding: 10px 10px 0 10px
var uploadFormPanel = new Ext.FormPanel({
fileUpload : true,
autoHeight : true,
height : 200,
bodyStyle : 'padding: 10px 10px 0 10px;',
labelWidth : 50,
defaults : {
anchor : '95%',
allowBlank : false,
msgTarget : 'side'
},
items: [
{
xtype : 'combo',
fields : ['id','name'],
name : 'fuelCompany',
store : comboStore,
valueField : 'id',
displayField : 'name',
submitValue : true,
typeAhead : true,
triggerAction : 'all',
selectOnFocus : true,
allowBlank : false,
mode : 'remote',
anchor : '95%'
},{
xtype : 'fileuploadfield',
id : 'form-file',
name : 'file',
buttonText : 'select file',
buttonCfg : {
iconCls : 'upload-icon'
}
}
]
});
这有点棘手,但我想我找到了如何让按钮显示文本的方法:
//...
{
xtype : 'fileuploadfield',
id : 'form-file',
name : 'file',
buttonCfg : {
text : 'select file'
}
}
//...
您需要将按钮文本放置在buttonCfg
中,以使按钮大小正确。唯一的缺点是,如果希望按钮自动调整大小,则无法将iconCls
添加到该按钮。作为替代方案,您可以使用一些变通方法:
//...
{
xtype : 'fileuploadfield',
id : 'form-file',
name : 'file',
buttonCfg : {
// The text cfg takes html too
text : '<div class="upload-icon"' +
' style="width: 15px; height: 15px; display: inline-block;' +
' margin: 0 5px;"></div>' +
'select file'
}
}
//...
/。。。
{
xtype:'fileuploadfield',
id:'表单文件',
名称:'文件',
按钮FG:{
//文本cfg也采用html
文本:“”+
“选择文件”
}
}
//...
它无法访问css文件,我将css样式放在jsp文件中,我的javascript代码定义了我的问题所在。文件上传字段似乎不是ExtJS 3的内置组件,至少我在文档中找不到它。这是您编写的扩展吗?我已经编辑了我使用的ExtJS版本。我使用了这个:我面临着同样的问题,你能告诉我你使用了什么css吗,我在cq中使用基于extjs的fileuploadfield组件。我添加了这个:.x-form-file-wrap{position:relative;height:22px;}.x-form-file-wrap.x-form-file{position:absolute;right:0;-moz不透明度:0;filter:alpha(不透明度:0);不透明度:0;z-index:2;高度:22px;}.x-form-file-wrap.x-form-file-btn{position:absolute;right:0;z-index:1;}.x-form-file-text{position:absolute;left:0;z-index:3;color:#777;}.upload图标{background:url('image_add.png')不重复0!重要;}