不带分页的 GWT 2.1 数据呈现小部件

发布于 2024-09-07 05:07:03 字数 169 浏览 3 评论 0原文

我正在尝试构建一个包含大型数据集的表,并希望避免分页。 (我想做一些类似于雅虎邮件网格的事情,它在绘制网格后检索数据。我认为最初检索前 100 封邮件,然后仅在用户向下滚动后检索邮件)

数据呈现小部件的示例我见过包括分页。可以做我想做的事吗?

编辑:您也可以将其称为无限滚动表

I am trying to build a table with large dataset and would like to avoid paging. (I would like to do something similar to Yahoo Mail grid which retrieves data after the grid is drawn. I think initially the first 100 mails are retrieved and then mail is only retrieved after the user scrolls down)

The example of the data presentation widget I have seen include paging. Is it possible to do what I want?

edit: You could also call this an infinite scroll table

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

寄居者 2024-09-14 05:07:22

是的,这是可能的。曾经有一个名为 DynaGrid 的示例此处,但该链接现在已失效。我在其他地方找不到它(注意:这与 SourceForge 上的 DynaGrid)。您也许可以联系作者 Reinier Zwitserloot,询问如何获取他的 DynaGrid 副本。您还可以搜索 GWT 群组,如果没有找到任何内容,在那里发帖询问是否有其他人知道在哪里可以找到它。

Yes, it is possible. There used to be an example of that called DynaGrid here but that link is dead now. I haven't been able to find it anywhere else (note: that's not the same as the DynaGrid on SourceForge). You might be able to contact the author, Reinier Zwitserloot, to inquire about getting a copy of his DynaGrid. You could also search the GWT Group and if you don't find anything, post there asking if anyone else knows where to find it.

并安 2024-09-14 05:07:22

Ext Gwt (AKA GXT) 具有支持此功能的“Live Grid”实现(请参阅 http://www.sencha.com/examples/explorer.html#livegrid)。该代码是 GPL,尽管您可以购买许可证以在商业应用程序中使用它。

Ext Gwt (AKA GXT) has an implementation of a "Live Grid" that supports this functionality (see http://www.sencha.com/examples/explorer.html#livegrid). The code is GPL although you can buy a license to use this in commercial applications.

ι不睡觉的鱼゛ 2024-09-14 05:07:21

Dean 已经提到了 Ext GWT,但我还想建议 SmartGWT 的实现

Dean already mentioned Ext GWT but I'd like to suggest SmartGWT's implementation as well.

乜一 2024-09-14 05:07:14

GWT 展示

/**
 * A scrolling pager that automatically increases the range every time the
 * scroll bar reaches the bottom.
 */
public class ShowMorePagerPanel extends AbstractPager {

  /**
   * The default increment size.
   */
  private static final int DEFAULT_INCREMENT = 20;

  /**
   * The increment size.
   */
  private int incrementSize = DEFAULT_INCREMENT;

  /**
   * The last scroll position.
   */
  private int lastScrollPos = 0;

  /**
   * The scrollable panel.
   */
  private final ScrollPanel scrollable = new ScrollPanel();

  /**
   * Construct a new {@link ShowMorePagerPanel}.
   */
  public ShowMorePagerPanel() {
    initWidget(scrollable);

    // Handle scroll events.
    scrollable.addScrollHandler(new ScrollHandler() {
      public void onScroll(ScrollEvent event) {
        // If scrolling up, ignore the event.
        int oldScrollPos = lastScrollPos;
        lastScrollPos = scrollable.getScrollPosition();
        if (oldScrollPos >= lastScrollPos) {
          return;
        }

        HasRows display = getDisplay();
        if (display == null) {
          return;
        }
        int maxScrollTop = scrollable.getWidget().getOffsetHeight()
            - scrollable.getOffsetHeight();
        if (lastScrollPos >= maxScrollTop) {
          // We are near the end, so increase the page size.
          int newPageSize = Math.min(
              display.getVisibleRange().getLength() + incrementSize,
              display.getRowCount());
          display.setVisibleRange(0, newPageSize);
        }
      }
    });
  }

  /**
   * Get the number of rows by which the range is increased when the scrollbar
   * reaches the bottom.
   *
   * @return the increment size
   */
  public int getIncrementSize() {
    return incrementSize;
  }

  @Override
  public void setDisplay(HasRows display) {
    assert display instanceof Widget : "display must extend Widget";
    scrollable.setWidget((Widget) display);
    super.setDisplay(display);
  }

  /**
   * Set the number of rows by which the range is increased when the scrollbar
   * reaches the bottom.
   *
   * @param incrementSize the incremental number of rows
   */
  public void setIncrementSize(int incrementSize) {
    this.incrementSize = incrementSize;
  }

  @Override
  protected void onRangeOrRowCountChanged() {
  }
}

There are an exemple of this in the GWT Showcase

/**
 * A scrolling pager that automatically increases the range every time the
 * scroll bar reaches the bottom.
 */
public class ShowMorePagerPanel extends AbstractPager {

  /**
   * The default increment size.
   */
  private static final int DEFAULT_INCREMENT = 20;

  /**
   * The increment size.
   */
  private int incrementSize = DEFAULT_INCREMENT;

  /**
   * The last scroll position.
   */
  private int lastScrollPos = 0;

  /**
   * The scrollable panel.
   */
  private final ScrollPanel scrollable = new ScrollPanel();

  /**
   * Construct a new {@link ShowMorePagerPanel}.
   */
  public ShowMorePagerPanel() {
    initWidget(scrollable);

    // Handle scroll events.
    scrollable.addScrollHandler(new ScrollHandler() {
      public void onScroll(ScrollEvent event) {
        // If scrolling up, ignore the event.
        int oldScrollPos = lastScrollPos;
        lastScrollPos = scrollable.getScrollPosition();
        if (oldScrollPos >= lastScrollPos) {
          return;
        }

        HasRows display = getDisplay();
        if (display == null) {
          return;
        }
        int maxScrollTop = scrollable.getWidget().getOffsetHeight()
            - scrollable.getOffsetHeight();
        if (lastScrollPos >= maxScrollTop) {
          // We are near the end, so increase the page size.
          int newPageSize = Math.min(
              display.getVisibleRange().getLength() + incrementSize,
              display.getRowCount());
          display.setVisibleRange(0, newPageSize);
        }
      }
    });
  }

  /**
   * Get the number of rows by which the range is increased when the scrollbar
   * reaches the bottom.
   *
   * @return the increment size
   */
  public int getIncrementSize() {
    return incrementSize;
  }

  @Override
  public void setDisplay(HasRows display) {
    assert display instanceof Widget : "display must extend Widget";
    scrollable.setWidget((Widget) display);
    super.setDisplay(display);
  }

  /**
   * Set the number of rows by which the range is increased when the scrollbar
   * reaches the bottom.
   *
   * @param incrementSize the incremental number of rows
   */
  public void setIncrementSize(int incrementSize) {
    this.incrementSize = incrementSize;
  }

  @Override
  protected void onRangeOrRowCountChanged() {
  }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文