带滚动的 TabLayoutPanel
我在 GWT 应用程序中使用 TabLayoutPanel,附加到页面的 RootLayoutPanel。
每个选项卡内都有一个 ScrollPanel,用于显示 FlexTable。
是否可以使 TabLayoutPanel 垂直增长,以便用户可以使用浏览器滚动条滚动整个页面,而不是使用内部 ScrollPanel ?
I'm using a TabLayoutPanel in a GWT application, attached to the RootLayoutPanel of the page.
Inside each tab I have a ScrollPanel, which is used to display a FlexTable.
Is it possible to make the TabLayoutPanel grow vertically, so the user can scroll the entire page using the browser scroll bar, instead of using the internal ScrollPanel ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
简短的回答是:使用 LayoutPanel 是不可能的。原因:LayoutPanel 是特定于需要填充浏览器客户端区域(即用户可见部分)的应用程序的。浏览器的问题之一是拥有一个恰好具有可见区域高度的小部件,并且在调整浏览器窗口大小时也会自动调整大小。这是 LayoutPanel 解决的问题之一。
如果您想使用浏览器滚动条并能够创建比可见区域长的页面,请使用“普通”面板。
顺便说一句,仅供参考,您知道 FlexTable 的渲染速度很慢,如果可能的话最好使用 Grid。
The short answer is: It's not possible with LayoutPanel's. The reason: LayoutPanel's are specific for applications that need to fill the browser client area, or in other words the part that is visible by the user. One of the problems with browsers is to have a widget that has exactly the height of the visible area and also automatically resizes when the browser window is resized. This is one of the problems the LayoutPanels solve.
If you want to use the browser scrollbar and be able to create pages longer than the visible area use the 'normal' Panels.
BTW just FYI you are aware the FlexTable is slow in rendering and if possible better use Grid.
只需向 TabLayoutPanel 添加新样式:
并在 CSS 中定义为:
这样,属性
overflow
将在 gwt-TabLayoutPanelContent 中被覆盖,并且滚动条将自动显示。Just add a new style to the TabLayoutPanel:
And define in your CSS as:
Thus, the property
overflow
will be overwritten in the gwt-TabLayoutPanelContent and the scrollbar will be shown automatically.如果您使 TabLayoutPanel 大于根面板,您将获得一个浏览器滚动条。
If you make the TabLayoutPanel bigger than the root panel, you will get a browser scroll bar.
如果我想实现这样的目标,我总是将 TabLayoutPanel 放入 SimplePanel 中,并将 SimplePanel 添加到 RootPanel 中。我想这不是最好的方法,但它确实有效。
If I want to achieve something like this, I always put the TabLayoutPanel in a SimplePanel and add the SimplePanel to the RootPanel. I guess this is not the best way, but it works.