Reputation: 17904
Is it possible to set the 'weight' of columns on a Grid in GXT? If so, how?
According to the Grid's Javadocs:
'Grid can resize columns based on a "weight". As the width of the grid, or columns change, the "weight" is used to allocate the extra space, or the space needed to be reduced.'
According to the docs, it says to set GridView.setAutoFill(true)
to enable this feature, but doesn't mention anything about configuring the weights.
Upvotes: 2
Views: 2587
Reputation: 2607
You define them when you create your ColumnConfigs
private List<ColumnConfig> getColumnConfigs() {
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
ColumnConfig col1ColumnConfig = new ColumnConfig("col1", "Col1", 50);
ColumnConfig col2ColumnConfig = new ColumnConfig("col2", "Col2", 75);
configs.add(col1ColumnConfig );
configs.add(col2ColumnConfig );
return configs;
}
ColumnModel cm = new ColumnModel(getColumnConfigs());
worklistGrid = new Grid<BeanModel>(store, cm);
worklistGrid.setAutoExpandColumn("col1"); //autoexpand
final GridView view = new GridView();
view.setAutoFill(true);
Upvotes: 3