Having some challenges with DataGrid in certain situations where
hierarchy of parents are not all *LayoutPanels. Thought
ResizeLayoutPanel would help there, but wondering why I'm seeing the
following in this example:
1.) If shrinking the screen from the bottom, you have to pull the
screen until almost half of the DataGrid is gone before the DataGrid
scrollbars appear - seems like the DataGrid doesn't understand that
it's not at the top of the FlowPanel it's inserted in.
ResizeLayoutPanel seems to be working and calling onResize() on the
DataGrid, but the DataGrid doesn't seem to know where it really is on
the screen.
2.) Not sure why the "d" button doesn't show up below the DataGrid.
Is this a bug or a misuse of the panels?
Here's the example:
-------------------------------------------------------------------------------------------------------
package test.client;
import java.util.ArrayList;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.cellview.client.DataGrid;
import com.google.gwt.user.cellview.client.TextColumn;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.ResizeLayoutPanel;
import com.google.gwt.user.client.ui.RootLayoutPanel;
public class Test implements EntryPoint {
public void onModuleLoad() {
DataGrid<String> dataGrid = new DataGrid<String>();
dataGrid.addColumn(new TextColumn<String>() {
public String getValue(String object) {
return object.toString();
}
}, "Category");
ArrayList<String> strings = new ArrayList<String>();
strings.add("abc");
strings.add("def");
strings.add("ghi");
strings.add("jkl");
strings.add("mno");
strings.add("pqr");
strings.add("stu");
strings.add("vwx");
strings.add("yz");
dataGrid.setRowData(strings);
FlowPanel contentPanel = new FlowPanel();
FlowPanel a = new FlowPanel();
a.add(new Button("a"));
contentPanel.add(a);
FlowPanel b = new FlowPanel();
b.add(new Button("b"));
contentPanel.add(b);
FlowPanel c = new FlowPanel();
c.add(new Button("c"));
contentPanel.add(c);
ResizeLayoutPanel resizePanel = new ResizeLayoutPanel();
resizePanel.setWidget(dataGrid);
resizePanel.setSize("100%", "100%");
contentPanel.add(resizePanel);
FlowPanel d = new FlowPanel();
d.add(new Button("d"));
contentPanel.add(d);
RootLayoutPanel.get().add(contentPanel);
}
}
----------------------------------------------------------------------------------
Thanks,
Aaron