Filefield与extjs 4.2没有fakepath [英] Filefield with extjs 4.2 without fakepath

查看:184
本文介绍了Filefield与extjs 4.2没有fakepath的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用extjs 4.2



我在附件中使用这个组件:

  {
xtype:'filefield',
id:'file6',
fieldLabel:'test',
labelWidth:100,
msgTarget:'一边',
allowBlank:false,
anchor:'100%',
buttonText:'upload'
},
pre>

我想拥有一个附件组件,显示没有此文本的文件名称:
c / fakepath

解决方案

没有一种内置的方法来完成这一点,但是您可以对fakepath进行查找/替换并删除。我在更改事件中推动了这一点。这是一个例子:

 监听器:{
change:function(fld,value){
var newValue = value.replace(/ C:\\fakepath\\ / g,'');
fld.setRawValue(newValue);
}
}

我创建了一个 sencha fiddle 演示一个工作示例


I want with extjs 4.2

I use this component in attachment :

{
    xtype: 'filefield',
    id: 'file6',
    fieldLabel: 'test ',
    labelWidth: 100,
    msgTarget: 'side',                  
    allowBlank : false,
    anchor: '100%',
    buttonText: 'upload'
},

I want to have a attachment component which display name of file without this text : c /fakepath

解决方案

There isn't a built-in way to accomplish this however, you can do a find/replace for fakepath and remove. I impelmented this on the change event. Here is an example:

listeners: {
                        change: function(fld, value) {
                            var newValue = value.replace(/C:\\fakepath\\/g, '');
                            fld.setRawValue(newValue);
                        }
                    }

I created a sencha fiddle demonstrating a working example

这篇关于Filefield与extjs 4.2没有fakepath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆