GWT - 实现TabLayoutPanel的编程选项卡选择,然后滚动到选项卡中包含的特定元素? [英] GWT - Implement programmatic tab selection of a TabLayoutPanel and then scroll to a particular element contained in the tab?
本文介绍了GWT - 实现TabLayoutPanel的编程选项卡选择,然后滚动到选项卡中包含的特定元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有2个选项卡的TabLayout面板。我想以编程方式选择第二个选项卡,然后滚动到选项卡中的特定元素。这是我的代码的样子:
I have a TabLayout panel with 2 tabs. I would like to programmatically select the 2nd tab and then scroll to a particular element within the tab. This is how my code looks like:
public void scrollToTextArea(final String textArea)
{
TabPanel.selectTab(1); //tab selection
textArea.getElement().scrollIntoView(); //scroll to text area field
}
我尝试使用延迟命令来运行滚动部分,但仍然无法获得正确的显示。
I tried using a deferred command to run the scroll portion, but was still unable to get the right display.
是否有特定的方法来实现此功能?
Is there a specific way to implement this functionality?
解决方案
This worked:
$ b {
TabPanel.selectTab(1); //选项卡选择
Scheduler.get()。scheduleDeferred(new Scheduler.ScheduledCommand()
{
public void execute()
{
textArea.getElement() .scrollIntoView();
}
});
}
这篇关于GWT - 实现TabLayoutPanel的编程选项卡选择,然后滚动到选项卡中包含的特定元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文