使用可折叠的extjs4

时间:2011-12-27 16:41:45

标签: javascript extjs4

我试图让ExtJS4中的一个面板折叠起来。当我使用“collapsible:true”时,面板在我的应用程序运行时是可折叠的。但如果我崩溃了面板它会消失,所以我无法解开它。

我不确定需要围绕我的面板或直接位于其上方。我尝试过使用示例代码:

{
region: 'north',
collapsible: false,
title: 'North',
split: true,
height: 100,
minHeight: 60,
html: 'north'
},

当我将其添加到我的视口以位于网页顶部时,这是有效的。但是当我将它定位在我希望它在页面上的位置时,我可以将其折叠但它会消失。任何人都可以让我知道在倒塌时它会导致什么消失?

2 个答案:

答案 0 :(得分:0)

我遇到了类似的问题并根据this解决了这个问题。基本上,请确保您在面板上指定了您遇到问题的权限布局配置,例如layout: 'fit'

答案 1 :(得分:0)

扩展Geronimo的答案,有时在面板上设置布局是不够的。在这种情况下,尝试使用布局fit将您的面板包裹在另一个面板中。而不是

{
  xtype: 'mypanel',
  title: 'my little panel',
  collapsible: true,
  ...
}

这样做:

{
  xtype: 'panel',
  title: 'my little panel', // Pull certain configs up to the wrapper panel,
  collapsible: true,        // like title and collapsible
  layout: 'fit',
  items: [
    {
      xtype: 'mypanel',
      title: undefined,     // Make sure there is not another title bar
      border: false,        // We don't want another border
      ...
    } 
  ]
}

不好但是到目前为止,我找不到更好的解决方案,它已经在我的两种不同情况下工作了。