6

大規模なデータセットを使用してテーブルを作成しようとしていますが、ページングを避けたいと考えています。(グリッドが描画された後にデータを取得するYahooメールグリッドと同様のことをしたいと思います。最初に最初の100通のメールが取得され、次にユーザーが下にスクロールした後にのみメールが取得されると思います)

私が見たデータプレゼンテーションウィジェットの例には、ページングが含まれます。私がやりたいことをすることは可能ですか?

編集:これを無限スクロールテーブルと呼ぶこともできます

4

4 に答える 4

4

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() {
  }
}
于 2010-10-25T19:27:12.200 に答える
1

ディーンはすでにExtGWTについて言及しましたが、 SmartGWTの実装も提案したいと思います。

于 2010-07-15T14:44:47.323 に答える
0

はい、可能です。ここにはDynaGridと呼ばれる例がありましたが、そのリンクは現在無効になっています。私は他のどこにもそれを見つけることができませんでした(注:それはSourceForgeのDynaGridと同じではありません)。作者であるReinierZwitserlootに連絡して、DynaGridのコピーの入手について問い合わせることができる場合があります。また、GWTグループを検索して、何も見つからない場合は、そこに投稿して、他の誰かがそれを見つける場所を知っているかどうかを尋ねることもできます。

于 2010-06-28T14:31:43.737 に答える
0

Ext Gwt(AKA GXT)には、この機能をサポートする「ライブグリッド」の実装があります(http://www.sencha.com/examples/explorer.html#livegridを参照)。コードはGPLですが、商用アプリケーションでこれを使用するためのライセンスを購入することもできます。

于 2010-07-08T11:30:55.760 に答える