epotvin
13 Jan 2010, 1:46 PM
I have a windows with a tab panel. One of his tab item contains the result of a query as a grid. When the application receive the result from the server, it render the grid and add it to the tab item (called resultTab).
The problem is that when the tab is already rendered, the grid do not appears.
Here is the code I run when I receive the result :
private Grid<ResultRow> grid;
private void refreshResultGrid(QueryResult queryResult)
{
resultTab.remove(grid);
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
for (ResultColumn column : queryResult.getColumns())
{
ColumnConfig columnConfig = new ColumnConfig();
columnConfig.setHeader(column.getColumnName());
columnConfig.setId(column.getColumnName());
columnConfig.setWidth(200);
configs.add(columnConfig);
}
ColumnModel cm = new ColumnModel(configs);
ListStore store = new ListStore();
store.add(queryResult.getRows());
grid = new Grid<ResultRow>(store, cm);
resultTab.add(grid, new BorderLayoutData(LayoutRegion.CENTER));
}
The first line remove the grid and the last one add the new one. The old grid is removed but the new one does not appears... How can I force it to be rendered correctly?
By the way, if this method is executed before the tab is selected, the grid is rendered correctly the moment the tab is selected.
Manu
The problem is that when the tab is already rendered, the grid do not appears.
Here is the code I run when I receive the result :
private Grid<ResultRow> grid;
private void refreshResultGrid(QueryResult queryResult)
{
resultTab.remove(grid);
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
for (ResultColumn column : queryResult.getColumns())
{
ColumnConfig columnConfig = new ColumnConfig();
columnConfig.setHeader(column.getColumnName());
columnConfig.setId(column.getColumnName());
columnConfig.setWidth(200);
configs.add(columnConfig);
}
ColumnModel cm = new ColumnModel(configs);
ListStore store = new ListStore();
store.add(queryResult.getRows());
grid = new Grid<ResultRow>(store, cm);
resultTab.add(grid, new BorderLayoutData(LayoutRegion.CENTER));
}
The first line remove the grid and the last one add the new one. The old grid is removed but the new one does not appears... How can I force it to be rendered correctly?
By the way, if this method is executed before the tab is selected, the grid is rendered correctly the moment the tab is selected.
Manu