gwt-incubator的ScrollTable我遇到了一个小问题。似乎ScrollTable已呈现,但它添加了“overflow:hidden”样式,这会使其对用户隐藏。
我正在使用GWT 2.0和UiBinder。我用来创建ScrollTable的代码是:
@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;
}
它与gwt-incubator的文档大致相同。我缺少什么?
答案 0 :(得分:0)
我忘了提及,我将ResizePolicy设置为“BOTH”。我把它取下后,桌子出现了。
要使滚动功能起作用,必须将高度CSS属性添加到ScrollTable。 :)