在Extjs 3.3中,如何在“选择文件”按钮附近添加另一个按钮?

时间:2013-04-06 23:43:52

标签: extjs append

我的问题是:我需要支持select local image files以及preview server side images,我正在使用插件FileUploadField。它有一个 用于从本地文件中选择的按钮,如何在其附近添加另一个按钮?

也许这是同一个问题:

如何找到按钮的父组件,并附加另一个子组(按钮)?

非常感谢。

1 个答案:

答案 0 :(得分:0)

您可以在字段呈现后添加自定义按钮

Ext.onReady(function(){
    var fp = new Ext.ux.form.FileUploadField({
        renderTo : Ext.getBody(),
        emptyText: 'Select an image',
        listeners : {
            afterrender : function(fupload) {
                this.customButton = new Ext.Button({
                    renderTo : Ext.getBody(),
                    cls: 'x-form-file-btn',
                    text : 'some button'
                });
                this.customButton.el.insertAfter(fupload.fileInput);
            }
        }
    });
});

示例:

JSFiddle Link