我的问题与这篇文章完全相似。 Build tree table with GWT CellTableBuilder
我在自定义数据网格上看到了GWT展示示例,但它有一个级别的折叠结构。但我想要的是上面帖子中提到的多层嵌套结构。我怎么能在“纯粹”中实现这一点“GWT。请帮忙!
答案 0 :(得分:1)
GWT树表:
您可以使用“披露”面板(性能很好)。在我的项目中,我已经尝试过使用单元格表的TableCellBuilder但不能达到预期的效果。
使用“Disclosure”面板,您也可以启用动画。我已经创建了更多300 Disclosure面板,一次命中来自mysql db的动态数据。我们可以通过在另一个Disclosure面板中创建新的Disclosure面板来构建多个级别。
答案 1 :(得分:1)
这里我给出了GWT - Tree表的示例代码。 您可以像这样添加n个子披露面板。
private DisclosurePanel getDisclosure() {
final DisclosurePanel disclosurePanel = new DisclosurePanel();
disclosurePanel.setHeader(new HTML("Top Disclosure"));
disclosurePanel.addOpenHandler(new OpenHandler<DisclosurePanel>() {
@Override
public void onOpen(OpenEvent<DisclosurePanel> event) {
disclosurePanel.setHeader(new HTML("Top Disclosure"));
// set sub1 DisclosurePanel here
disclosurePanel.setContent(getSub1Disclosure());
}
});
return disclosurePanel;
}
private DisclosurePanel getSub1Disclosure() {
final DisclosurePanel disclosurePanel = new DisclosurePanel();
disclosurePanel.setHeader(new HTML("Sub1 Disclosure"));
disclosurePanel.addOpenHandler(new OpenHandler<DisclosurePanel>() {
@Override
public void onOpen(OpenEvent<DisclosurePanel> event) {
disclosurePanel.setHeader(new HTML("Sub1 Disclosure"));
// set sub2 DisclosurePanel here
disclosurePanel.setContent(getSub2Disclosure());
}
});
return disclosurePanel;
}