javascript - 多个文件上传 Extjs 6 现代工具包

标签 javascript extjs extjs6 sencha-touch-2.3 extjs6-modern

我已经在 Extjs Classic 中完成了多个文件上传,现在我想在 Modern 工具包中实现它,但存在问题 没有 fileButton 字段 所以我正在使用文件字段,但我不确定如何从文件字段获取文件数据,这里是代码:

                             {
                                xtype: 'fieldset',
                                title: 'Attechments',
                                reference: 'attachmentfile',
                                padding: 10,
                                layout: {
                                    type: 'vbox',
                                    align: 'stretch'
                                },
                                defaults: {
                                    labelWidth: 130
                                },
                                items: [
                                    {
                                        xtype: 'filefield',
                                        text: 'Attach Files',
                                        name: 'files',
                                        listeners:{
                                            change: 'onFileChange'
                                        }
                                    }
                                ]
                            }

在 View Controller 中:

onFileChange: function (field, e, value) {
       // how to get fileField data so that i can upload via ajax and attach //more files options
}

最佳答案

在 ExtJS 6 经典工具包中:

var file = filefield.fileInputEl.dom.files[0];

在 ExtJS 6 现代工具包中:

var file = filefield.getComponent().getFiles()[0];

经典演示here

现代演示 here

关于javascript - 多个文件上传 Extjs 6 现代工具包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43983713/

相关文章:

javascript - 网格停靠摘要上的错误

javascript - extjs中的分组(数据在分组行的列中)

javascript - ExtJS 无法读取未定义的属性 'stopEvent'

javascript - 是否可以确定我的网站页面是在新窗口中还是其中一个选项卡?

javascript - 如何在 html 中实现快速闪烁文本或简单地更快地替换文本(我的代码如下)

javascript - 遍历一组元素并设置动画

javascript - 选择网格中的特定单元格 - Ext JS

javascript - 如何在单个 View /页面中呈现两个电子签名组件?

javascript - Ext JS 6.5 菜单自动隐藏

javascript - div 内的滚动 div 出现在具有较高 z-index 的 div 上