2012-12-05 106 views
0

我有以下情況。我有一個Ext.form.field.FilebuttonOnly: trueExt.form.Panel之上,它位於工具欄的頂部,位於Ext.grid.Panel的一個工具欄上,結果是,該按鈕的風格與工具欄完全不同,面板似乎有一些白色任何人都可以解決這個問題,所以按鈕和麪板的樣式與工具欄相匹配(我使用默認樣式,沒有修改任何東西)。工具欄頂部的Ext.form.Panel有一些空白區域

編輯:這裏是一些代碼:

upload_button = Ext.create('Ext.form.field.File', { 
      buttonOnly: true, 
      buttonText: "Upload File", 
      hideLabel: true, 
      listeners: {..} 

     }); 

     button_panel = Ext.create('Ext.form.Panel', { 
      region: 'south', 
      items: upload_button 
     }); 


    upload_toolbar = Ext.create('Ext.toolbar.Toolbar',{ 
      width: 400, 
      region: 'north', 
      dock: 'top', 
      items: [ button_panel]}); 

grid_file = Ext.create('Ext.grid.Panel', { 
      title: 'File List', 
      region: 'center', 
      height: 300, 
      store: store_file, 
      dockedItems: [upload_toolbar], 
+2

我不知道「頂部」是足夠清楚。如果您提供一些代碼和屏幕截圖,則您更有可能獲得答案。這聽起來很奇怪,所以我認爲這只是一個錯誤配置,但解決方案可能需要一些css破解。 – Izhaki

+0

也許我應該說「裏面的」?不太確定如何正確使用它。 –

+0

是的。 '裏面'聽起來好多了。 – Izhaki

回答

1

您正在使用的區域,但我看不到任何border佈局

0123。

你的問題是你正試圖把一個面板放在工具欄中 - 它不會工作。

你最好只在你的頁面上放置一個隱藏的上傳表單;在工具欄中放置一個普通的按鈕,然後使用工具欄按鈕按下隱藏窗體上的按鈕。

因此,這將是隱藏的上傳表單定義:

Ext.define('App.view.Assignments' , 
{ 
    extend: 'Ext.panel.Panel', 
    alias: 'widget.assignments-panel', 

    hidden: true, 

    items: [{ 
     xtype: 'filefield', 
     id: 'uploadField', 
     emptyText: 'Select a file', 
     fieldLabel: 'Assignment', 
     name: 'assignment-path', 
     buttonText: '...', 
     buttonConfig: { 
      iconCls: 'upload-icon' 
     } 
    },{ 
     xtype: 'hidden', 
     id: 'submissionIdField', 
     name: 'submissionId', 
     value: '' 
    }], 
}); 

然後當按下可見更新按鈕,你可以這樣做:

var uploadField = Ext.getCmp('uploadField'); 
uploadField.fileInputEl.dom.click(); 
+0

工作得很好。如果你有一個時刻你可以看看:http://stackoverflow.com/questions/13746671/how-to-get-an-extjs-application-to-look-like-the-feed-example –