在celltable gwt中滚动时从服务器获取数据

时间:2013-08-02 05:40:19

标签: gwt

我需要在GWT中实现一个已存在于smartgwt中的功能。在smartgwt中,我们可以设置网格中记录的最大限制为75.当滚动时记录计数达到75时,它再次请求服务器并获取另外75条记录。我必须在GWT中实现类似的功能。即,在滚动时,我必须每75条记录从服务器获取记录。可能吗??请协助。

1 个答案:

答案 0 :(得分:0)

当用户到达scoll的末尾时,您可以使用ScrollPanel进行检查。

您可以尝试这个代码示例,并根据您的情况进行调整:

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的文件。

Another example of use