tags:

views:

274

answers:

1

Hello,

I'm having a small problem with gwt-incubator's ScrollTable. It seems the ScrollTable is rendered, but it has "overflow: hidden" style added to it, which causes it to be hidden from users.

I'm using it with GWT 2.0 and UiBinder. The code I use to create the ScrollTable is:

 @UiFactory ScrollTable createCompaniesTable() {
  FixedWidthGrid dataTable = createDataTable();
  FixedWidthFlexTable headerTable = createHeaderTable();

  return new ScrollTable(dataTable, headerTable);
 }

 private FixedWidthFlexTable createHeaderTable() {
  // Create a new table
  FixedWidthFlexTable headerTable = new FixedWidthFlexTable();
  FlexTable.FlexCellFormatter formatter = headerTable.getFlexCellFormatter();

  // Level 1 headers
  headerTable.setHTML(0, 0, "<b>Student Profiles</b>");
  formatter.setColSpan(0, 0, 6);
  formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);

  // Level 2 headers
  headerTable.setHTML(1, 0, "<b>General</b>");
  formatter.setColSpan(1, 0, 4);
  formatter.setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER);
  headerTable.setHTML(1, 1, "<b>Student ID</b>");
  formatter.setRowSpan(1, 1, 2);
  formatter.setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_CENTER);
  headerTable.setHTML(1, 2, "<b>GPA</b>");
  formatter.setRowSpan(1, 2, 2);
  formatter.setHorizontalAlignment(1, 2, HasHorizontalAlignment.ALIGN_CENTER);

  // Level 3 headers
  headerTable.setHTML(2, 0, "Last Name");
  formatter.setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_CENTER);
  headerTable.setHTML(2, 1, "First Name");
  formatter.setHorizontalAlignment(2, 1, HasHorizontalAlignment.ALIGN_CENTER);
  headerTable.setHTML(2, 2, "Age");
  formatter.setHorizontalAlignment(2, 2, HasHorizontalAlignment.ALIGN_CENTER);
  headerTable.setHTML(2, 3, "Hometown");
  formatter.setHorizontalAlignment(3, 3, HasHorizontalAlignment.ALIGN_CENTER);

  return headerTable;
 }

 private FixedWidthGrid createDataTable() {
  // Create a new table
        FixedWidthGrid dataTable = new FixedWidthGrid(100, 10);

        // Set some options in the data table
        dataTable.setSelectionPolicy(SelectionGrid.SelectionPolicy.MULTI_ROW);
  dataTable.insertRow(0);
  dataTable.setHTML(0, 0, "<b>Hello, World!</b>");


        // Return the data table
        return dataTable;
 }

It's mostly the same as in gwt-incubator's documentation. What I'm missing?

A: 

I forgot to mention, I had ResizePolicy set to "BOTH". After I removed it, the table showed up.

To get the scrolling functionality to work, one must add height CSS attribute to the ScrollTable. :)

mnylen