PDA

View Full Version : [GXT 1.2.4] Grid (w/forceFit) reconfigure causes the force fit to not work



matthewdfleming
26 Jun 2009, 1:05 PM
When you create a grid like so:


grid = new EditorGrid<BeanModel>(store, firstColumnModel);
grid.getView().setForceFit(true)

a subsequent call to

grid.reconfigure(store, aDifferentColumnModel);
will show the grid with the new column model, but the columns will not take up the viewport space.

The issue appears to be with the GridView.layout() method and it not calling the fitColumns() method (because the view width hasn't changed). As a work around, I created my own view class that calls the required methods on the View class (which are protected).


public class RefreshableGroupingView extends GroupingView {
public void afterReconfigure() {
fitColumns(true, true, -1);
updateAllColumnWidths();
}
}

In the workaround it goes like this:


RefreshableGroupingView view = new RefreshableGroupingView();
view.setForceFit(true);
EditorGrid<BeanModel> grid = new EditorGrid<BeanModel>(store, firstColumnModel);
grid.setAutoExpandColumn("question.questionText");
grid.setStripeRows(true);
grid.setView(view);
grid.reconfigure(store, aDifferentColumnModel);
view.afterReconfigure();