简体   繁体   English

在extjs4中使用可折叠

[英]Using collapsible with extjs4

I am trying to make one of my panels in ExtJS4 collapsible. 我正在尝试使ExtJS4中的面板之一可折叠。 When I use "collapsible: true" the panel is collapsible when my application is running. 当我使用“ collapsible:true”时,运行我的应用程序时面板是可折叠的。 But if I collapse the panel it disappears so I can't uncollapse it. 但是,如果我折叠面板,它就会消失,所以我无法对其进行折叠。

I am not sure what needs to surround my panel or be directly above it. 我不确定需要围绕面板还是直接在面板上方。 I have tried using sample code: 我尝试使用示例代码:

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

That works when I add it to my viewport to be at the top of the webpage. 当我将其添加到网页顶部的视口中时,该方法就起作用了。 But when I position it to be in the location I want it on the page I can collapse it but it then dissappears. 但是,当我将其放置在页面上我想要的位置时,我可以将其折叠,但随后消失。 Can anyone let me know whatwould cause it to dissappear when collapsed? 谁能让我知道折叠后会消失的原因是什么?

Expanding on Geronimo's answer, it is sometimes not enough to set the layout on the panel itself. 扩展Geronimo的答案,有时仅在面板本身上设置布局是不够的。 In that case try wrapping your panel in another one with layout fit . 在这种情况下,请尝试将您的面板包装成另一块fit布局的面板。 Instead of 代替

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

do this: 做这个:

{
  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
      ...
    } 
  ]
}

Not nice but so far, I couldn't find a better solution and it did work in two different situations for me already. 不好,但到目前为止,我找不到更好的解决方案,它对我来说已经在两种不同的情况下起作用了。

I had a similar problem and solved it based off of this . 我有一个类似的问题,解决它基于关闭的这个 Basically, make sure you have the rightt layout config specified on the panel your having trouble with, something like layout: 'fit' . 基本上,请确保您在遇到麻烦的面板上指定了正确的布局配置,例如layout: 'fit'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM