18 Jun 2014 8:39 PM #1
Unanswered: Is there a way to pin the title of a TabPanel to the top of the page?
I have a TabPanel which has a very long label inside one of its tabs (so the user has to scrolls down to see all the content), is there a way I can scroll the label not the tab? I mean instead of scrolling the whole page (which hide the title of the tabs) can I do something to pin the title of the tabs to the top of the page?
I couldn't find any way to do so. Would be very happy if anyone can help
Thank you in advance
19 Jun 2014 11:13 PM #2
Instead of label, use HTMLPanel, and add it your tabpanel.
See the code
TabPanel tabPanel = new TabPanel(); tabPanel.add(new Label("Really short test"), "Short text"); SafeHtml giantContent = getLongText(); HTMLPanel longText = new HTMLPanel(giantContent); longText.getElement().getStyle().setOverflow(Overflow.AUTO); tabPanel.add(longText, "Long text");
22 Jun 2014 3:40 PM #3
Thank you for our reply, but it won't solve my problem. To me it doesn't matter what kind of widget is inside the tab (it will be more than one type), I want to pin the tab title at the top of the page, so when the user scroll down they can see the tabs and be able to switch between them without scrolling up again.
23 Jun 2014 10:35 PM #4
For every widget, the setOverFlow property is there. So, you can easily use that. In my opinion, there is no any direct way to pin the title of TabPanel at the top.
You can think of some other ideas like, take ToolBar at the top of container,add buttons to it, acting as tabs. Toolbar locations will be fixed. Attach actions to change the contents of your container on button click as per requirement. This should be easy task, and it will solve your purpose
3 Jul 2014 3:52 PM #5
Thank you vardhan22,
I have to agree with you it seems there is no direct way of pinning the title of TabPanel to the top of the page. I tried so many things and yet nothing works.