简体   繁体   English

如何隐藏GridPanel的主体?

[英]How to hide body of gridpanel?

My grid have some docked toolbars and i want to hide only grid body. 我的网格有一些停靠的工具栏,我只想隐藏网格主体。 I tried to hide like this: 我试图这样隐藏:

mygrid.body.hide();

rows disappeared but container height not changed. 行消失了,但是容器的高度没有改变。 So instead grid rows I got empty space.. 所以网格行却变成了空白。

So how can I collapse and expand gridpanel body? 那么如何折叠和展开网格面板主体?

尝试在网格上调用doLayout()和/或doComponentLayout()

You can try like this: 您可以这样尝试:

  • Hide the headercontainer of the grid with hide(), if needed (this contains the grid header row) 如果需要,使用hide()隐藏网格的headercontainer容器(其中包含网格标题行)
  • Hide the body of the grid with hide() as you did. 像您一样,使用hide()隐藏网格的主体。
  • Set the height of grid to appropriate value: grid.setHeight(grid_header_height + grid_toolbar_height). 将网格的高度设置为适当的值:grid.setHeight(grid_header_height + grid_toolbar_height)。 Plus grid_headercontainer_height to if needed. 如果需要,将grid_headercontainer_height加到。

你有没有尝试过

mygrid.collapse();

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

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