我有麻煩了FormPanel中的煎茶觸摸2.佈局參見下面的示例應用程序。煎茶觸摸2 FormPanel中沒有顯示正確(佈局問題?)
應該有與含有3項「VBOX」佈局的面板:一段文字,FormPanel中,和另一塊文字。然而,FormPanel似乎獲得大小0x0並且根本不顯示,所以我只能看到兩個文本。
我發現2個東西,拿到表格面板展現出來:
外面板上設置
layout: 'fit'
。但是,然後一切重疊。fit
並非真正爲多個項目設計,所以這不是一個解決方案。設置顯式
width
和height
在FormPanel上配置。但我希望它自己佈局,而不必用像素來指定它。爲什麼我需要這樣做?
我試了一堆其他的隨機參數,但我只是在黑暗中拍攝。那麼我錯過了什麼?
Ext.application({
name: 'TestApp',
launch: function() {
return Ext.Viewport.add({
xtype: 'panel',
layout: {
type: 'vbox',
align: 'center'
},
// layout: 'fit' // This shows the form, but overlaps all 3 panel items.
items: [
{ html: 'Fill in the form below' },
{
xtype: 'formpanel',
// width: 300, // These fixed sizes reveal the form, but why?
// height: 300, // These fixed sizes reveal the form, but why?
items: [
{
xtype: 'fieldset',
items: [
{
xtype: 'textfield',
name: 'username',
label: 'Username'
}
]
}
]
},
{ html: 'Fill in the form above' }
]
});
}
});
請參閱下面的@ pfrank的答案,瞭解其原因。 – dkamins 2013-07-29 19:18:20
在Sencha 2.3上,'scrollable:false'不適用於我。 'scrollable:null'是。 – 2014-04-04 03:34:42
不能使用false。由於這沒有記錄,所以在將來可以改變,因爲使用null – 2014-06-06 08:30:27