PDA

View Full Version : Column Auto Expand not working with BeanModel



polloelastico
12 Aug 2009, 12:59 PM
The following code does not maximize the grid column. However, it does work if the BeanModels are not used and classes are converted to String maps. Am I missing something?




BeanModelFactory factory = BeanModelLookup.get().getFactory(SomeClass.class);

List<BeanModel> model = factory.createModel(items);

final ListStore<BeanModel> store = new ListStore<BeanModel>();
store.add(model);

List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
columns.add(selectionModel.getColumn());
columns.add(new ColumnConfig("name", "Name", 250));
columns.add(new ColumnConfig("authorName", "Author", 200));
columns.add(new ColumnConfig("type", "Type", 300));

ColumnModel cm = new ColumnModel(columns);

Grid grid = new Grid<BeanModel>(store, cm);
grid.setStripeRows(true);
grid.setAutoWidth(true);
grid.setSelectionModel(selectionModel);
grid.setBorders(true);
grid.addPlugin(selectionModel);
grid.setAutoExpandColumn("type");