Sunday, May 13, 2012

RootLayoutPanel versus RootPanel with ScrollPanel

I've been having a problem getting ScrollPanel to work as expected (or as I expect) in my app.  So, I've reduced the problem to a simple case.

The code below is from the example of a Custom Data Provider that Google provides in the CellWidgets Developer Guide:

https://developers.google.com/web-toolkit/doc/latest/DevGuideUiCellWidgets  (scroll down to Custom Data Source to see the code).

Question is, why doesn't this work when RootPanel is replaced with RootLayoutPanel?  No scroll bars appear at all, and that is what I'm experiencing in my app.

Mike

public class RangeChangeHandlerExample implements EntryPoint {

 
@Override
 
public void onModuleLoad() {
   
// Create a CellList.
   
final CellList cellList = new CellList(new TextCell());

   
// Add a range change handler.
    cellList
.addRangeChangeHandler(new RangeChangeEvent.Handler() {
     
@Override
     
public void onRangeChange(RangeChangeEvent event) {
       
Range range = event.getNewRange();
       
int start = range.getStart();
       
int length = range.getLength();

       
// Create the data to push into the view. At this point, you could send
       
// an asynchronous RPC request to a server.
       
List data = new ArrayList();
       
for (int i = start; i < start + length; i++) {
          data
.add("Item " + i);
       
}

       
// Push the data into the list.
        cellList
.setRowData(start, data);
     
}
   
});

   
// Force the cellList to fire an initial range change event.
    cellList
.setVisibleRangeAndClearData(new Range(0, 25), true);

   
// Create paging controls.
   
SimplePager pager = new SimplePager();
    pager
.setDisplay(cellList);

   
// Add the widgets to the root panel.
   
VerticalPanel vPanel = new VerticalPanel();
    vPanel
.add(pager);
    vPanel
.add(cellList);
   
RootPanel.get().add(vPanel);
 
}
}


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/T0E8dvciA2MJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate