2010-06-27 13 views
6

Próbuję zbudować tabelę z dużym zestawem danych i chcę uniknąć stronicowania. (Chciałbym zrobić coś podobnego do siatki poczty Yahoo Mail, która pobiera dane po narysowaniu siatki.Myślę, że początkowo odebranych zostanie pierwszych 100 wiadomości, a następnie poczta zostanie odzyskana dopiero po przewinięciu użytkownika)GWT 2.1 Prezentacje danych Widżety bez stronicowania

Przykład Widżet prezentacji danych, który widziałem, zawiera stronicowanie. Czy można robić to, co chcę?

edit: Można również zadzwonić ten nieskończony przewijać stół

Odpowiedz

1

Dean wspomniał już o Ext GWT, ale chciałbym również zasugerować SmartGWT's implementation.

+0

Twój link nie był poprawny, ale i tak go znalazłem. Podoba mi się: http://www.smartclient.com/smartgwt/showcase/#featured_grid_live – Tihom

0

Tak, jest to możliwe. Kiedyś był to przykład o nazwie DynaGrid here, ale ten link jest już martwy. Nie mogłem go znaleźć nigdzie indziej (uwaga: to nie to samo co DynaGrid on SourceForge). Możesz skontaktować się z autorem, Reinierem Zwitserlootem, aby dowiedzieć się o otrzymaniu kopii DynaGrid. Możesz także przeszukać GWT Group, a jeśli nic nie znajdziesz, opublikuj pytanie, czy ktoś jeszcze wie, gdzie go znaleźć.

+0

Próbowałem szuka dynagrid ale nie byli w stanie go znaleźć. Ponadto chciałbym użyć widżetu, który jest używany przez innych i jest utrzymywany. Właśnie dlatego chciałem użyć widżetu do prezentacji danych. – Tihom

4

Tam są exemple tego w 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() { 
    } 
}