2014-10-30 46 views
1

我正在使用extjs fileuploadfield(xtype)。如何布局extjs fileuploadfield部件

当我加入这个我面板看起来很普通:

enter image description here

的文本字段应伸出的“文件:”结束标签,最好我想浏览按钮更多的权利。这是我如何使用它:

   layout: { 
        type: 'anchor' 
       }, 
       items: [ 
        { 
         flex: 1, 
         xtype: 'label', 

         text: 'Upload', 
         style: 'font-weight: bold', 
         height: 22 
        }, 
        { 
         flex: 1, 
         xtype: 'radio', 
         boxLabel: 'Client [Pfad/Dateiname]', 
         name: 'radioradio', 
         itemId:'RadioClientUploadWindow', 
         checked: 'true' 
        }, { 
         flex: 1, 
         xtype: 'fileuploadfield', 
         id: 'filedata', 
         emptyText: 'Select a document to upload...', 
         fieldLabel: 'File ', 
         buttonText: 'Browse ' 
        }, 

是否有某种方式使这个组件看起来合理可以吗?

回答

1

奥利弗,

设计表单时,煎茶脑子里想的,你会在你的形式很多领域,因此,所有的标签具有相同的宽度,使你的屏幕上一致的外观。

您的表单看起来很奇怪,因为您只有一个表单字段。要调整您的宽度,只需将您的labelWidth设置为适合您的表单的任何内容(我相信40将适合您),另外,我认为设置flexanchor布局无效,请尝试将其替换为anchor: 100%。 这应该让你的领域看起来更好:

{ 
    xtype: 'fileuploadfield', 
    anchor: '100%', 
    labelWidth: 40, 
    id: 'filedata', 
    emptyText: 'Select a document to upload...', 
    fieldLabel: 'File ', 
    buttonText: 'Browse ' 
}