PDA

View Full Version : [FIXED] [2.0 RC2] 2 TreeGrid bugs



Pandaman
6 Jul 2009, 11:03 AM
- GXT version: 2.0 RC2
- Mode: web
- Browser and version: Firefox 3.0.11, IE 6 (haven't tried any other browsers)
- Operating System: Windows XP SP3

I am running into a couple bugs with TreeGrid. The code located at the bottom of this post is supposed to populate the TreeGrids on tabs 1 and 2 with parent0-parent9 such that parent0-parent4 each have 1 child. Here are the steps where that doesn't happen:


1st bug:
- refresh page (ctrl-r)
- make sure Tab 1 is the tab in view
- click Refresh Tab 1, then Refresh Tab 2
- Click Tab 2
>> Duplicate parent data for Tab 2s TreeGrid, parent0 is the only node with a child


2nd bug:
- Follow steps for 1st bug
- click Tab 1
- click Refresh Tab 1, then Refresh Tab 2
- click Tab 2
>> Only some parents have been loaded into view (for me, only parent0-parent2 w/ appropriate children). When name column is sorted, the rest of the data is loaded into view.




public void onModuleLoad() {
final Viewport viewport = new Viewport();
final ContentPanel contentPanel = new ContentPanel(new FitLayout());
contentPanel.setSize(600, 500);

final TabPanel tabPanel = new TabPanel();
final TabItem tab1 = new TabItem("Tab 1");
final TabItem tab2 = new TabItem("Tab 2");

final TreeGrid<ModelData> treeGrid1 = buildTestTreeGrid();
final TreeGrid<ModelData> treeGrid2 = buildTestTreeGrid();

tab1.add(treeGrid1);
tab2.add(treeGrid2);

tabPanel.add(tab1);
tabPanel.add(tab2);

contentPanel.add(tabPanel);

contentPanel.addButton(new Button("Refresh Tab 1", new TestSelectionListener(treeGrid1)));
contentPanel.addButton(new Button("Refresh Tab 2", new TestSelectionListener(treeGrid2)));

viewport.add(contentPanel);
RootPanel.get().add(viewport);
}

public static TreeGrid<ModelData> buildTestTreeGrid() {
final List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
final ColumnConfig column = new ColumnConfig("name", "name", 500);
columns.add(column);
column.setRenderer(new TreeGridCellRenderer<BeanModel>());
final TreeGrid<ModelData> treeGrid = new TreeGrid<ModelData>(new TreeStore<ModelData>(), new ColumnModel(columns));
treeGrid.setHeight(400);

return treeGrid;
}

public static class TestSelectionListener extends SelectionListener<ButtonEvent> {

private final TreeGrid<ModelData> _treeGrid;

public TestSelectionListener(final TreeGrid<ModelData> treeGrid) {
_treeGrid = treeGrid;
}

@Override
public void componentSelected(ButtonEvent ce) {
final TreeStore<ModelData> treeStore = _treeGrid.getTreeStore();

treeStore.removeAll();

final List<ModelData> parents = new ArrayList<ModelData>();

for (int i=0; i<10; i++) {
final BaseModelData parent = new BaseModelData();
parent.set("name", "parent" + i);

parents.add(parent);
}

treeStore.add(parents, false);

for (int i=0; i<5; i++) {
final BaseModelData child = new BaseModelData();
child.set("name", "child" + i);

treeStore.add(parents.get(i), child, false);
}

_treeGrid.getView().refresh(true);
}

}

sven
6 Jul 2009, 11:05 AM
In the meantime GXT2 final was released. I suggest to upgrade to it (RC3 was also released before)

Many treegrid bugs got fixed. Try your code with the new release please.

Pandaman
6 Jul 2009, 11:25 AM
Oh I didn't even notice. I'll take the full release for a spin then, thanks.

Pandaman
6 Jul 2009, 12:06 PM
These bugs still exist in the final release version

Pandaman
13 Jul 2009, 5:45 AM
Any progress on this?

sven
13 Jul 2009, 6:05 AM
There are a couple of issues in your code. You are trying to refresh a not rendered grid. You first have to check if the grid is rendered or you need to set deferredrenderingof your tabpanel to false. However adding something to the store also throws an exception if the grid is not rendered. This is fixed in SVN now.

For your second issue you need to use HideMode.OFFSET on the tabitems.

Pandaman
13 Jul 2009, 7:21 AM
Thank you for your response, this solved my issues.