PDA

View Full Version : Grid autoExpand not working



Quartilan
12 Dec 2011, 9:06 AM
Can some1 pls tell me what I'm doing wrong? My grid wont fill the entire grids width.

The grid is correctly sized in width but the 1 column does not take the whole width of the grid.


public class LayoutContainerX extends LayoutContainer {
private final ColumnConfig c = new ColumnConfig("value","value", 200);

private final ListStore<ModelData> store = new ListStore<ModelData>();

private final Grid<ModelData> grid = new Grid<ModelData>(store, new ColumnModel(Arrays.asList(c)));

public LayoutContainerX(){


grid.setAutoExpandColumn("value");
grid.setAutoHeight(true);
}


@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
for (int i=0; i<10; i++){
BaseModelData data = new BaseModelData();
data.set("value", "value");
store.add(data);
}
add(grid);
}






}

Quartilan
13 Dec 2011, 5:39 AM
I found that when I add the fillLayout to the parent layoutContainer that it works but now I have the problem that when I have a vertical scrollbar the resizing of the layoutcontainer is not taken into account.

_sandro_
13 Dec 2011, 11:54 AM
Try this:



public class LayoutContainerX extends LayoutContainer {
private final ColumnConfig c = new ColumnConfig("value","value", 200);
private final ListStore<ModelData> store = new ListStore<ModelData>();
private final Grid<ModelData> grid = new Grid<ModelData>(store, new ColumnModel(Arrays.asList(c)));

public LayoutContainerX(){
this.setLayout(new FitLayout()); // other Layouts that fill the free space may work
grid.setAutoExpandColumn("value");
grid.setAutoHeight(true);
grid.getView().setForceFit(true);
}

@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
for (int i=0; i<10; i++) {
BaseModelData data = new BaseModelData();
data.set("value", "value");
store.add(data);
}
add(grid);
}
}

Quartilan
14 Dec 2011, 4:24 AM
I tried it but no succes. After I sort the column then the column expands to the full size. But that is a bit late :-)