我需要在 GWT 中实现 smartgwt 中已经存在的功能。在 smartgwt 中,我们可以设置网格中记录的最大限制为 75。当滚动时记录数达到 75 时,它会再次请求服务器并获取另外 75 条记录。我必须在 GWT 中实现类似的功能。即,在滚动时,我必须从服务器中获取每 75 条记录的记录。可能吗??请协助。
问问题
147 次
1 回答
0
您可以使用 ScrollPanel 来检查用户何时到达 scoll 的末尾。
您可以尝试此代码示例,并根据您的情况对其进行调整:
String loremIpsum = "a long text..."; // add a long text here for test
ScrollPanel sPanelTest = new ScrollPanel(loremIpsum);
sPanelTest.addScrollHandler(new ScrollHandler() {
@Override
public void onScroll(ScrollEvent event) {
int maxPosition = sPanelTest.getMaximumVerticalScrollPosition();
int currentPosition = sPanelTest.getVerticalScrollPosition();
if(currentPosition == maxPosition)
Window.alert("Tadam !"); // end of the scroll
}
});
ScrollPanel的文档。
于 2013-08-02T08:30:16.537 回答