Karthik207
Karthik207

Reputation: 493

Build custom tree table in GWT

My question is exactly similar to this post. Build tree table with GWT CellTableBuilder

I saw GWT showcase example on custom data grid,but it has a single level of collapsing structure.But what i want is more than one level of nesting structure as mentioned in the above post.How can i achieve this in "pure" GWT.Please help!.

Upvotes: 0

Views: 338

Answers (2)

Prasanth Np
Prasanth Np

Reputation: 175

Here i have give sample code for GWT - Tree table. You can add n - number of sub disclosure panel like this.

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;
}

Upvotes: 1

Prasanth Np
Prasanth Np

Reputation: 175

GWT Tree Table:

You can use Disclosure panel(perfomance is good). In my project i have tried TableCellBuilder with cell table but not works what i expected.

Using Disclosure panel you can enable animation also. I have created more that 300 Disclosure panel at a single hit dynamically data from mysql db. we can build multi levels by creating new Disclosure panel within another Disclosure panels.

Upvotes: 1

Related Questions