1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    5
    Vote Rating
    0
    swilber1579 is on a distinguished road

      0  

    Default Grid sizing and column width

    Grid sizing and column width


    I am trying to create a grid that fills the width of a ContentPanel. The grid should have two columns of equal size that span the entire width of the grid. Resizing the browser window should update the grid size accordingly. I would expect the code below to accomplish this, but the grid does not grow on browser resize and there is a ~10px gap between the second column and the right edge of the grid.

    Thanks for any help you can provide.

    Code:
    public class MyGrid extends ContentPanel {
        
    @Override
        protected void onRender(Element parent, int index) {
            super.onRender(parent, index);
            
            setLayout(new FitLayout());
            ColumnConfig c1 = new ColumnConfig("value","value", 50);
            ColumnConfig c2 = new ColumnConfig("value1","value1", 50);
            ListStore<ModelData> store = new ListStore<ModelData>();
            for (int i=0; i<10; i++) {
              BaseModelData data = new BaseModelData();
              data.set("value", "value");
              data.set("value1", "value1");
              store.add(data);
            }
            Grid<ModelData> grid = new Grid<ModelData>(store, new ColumnModel(Arrays.asList(new ColumnConfig[] {c1, c2})));
            grid.setAutoHeight(true);
            grid.getView().setAutoFill(true);
            grid.getView().setForceFit(true);
            add(grid); 
        }
    }

  2. #2
    Sencha User
    Join Date
    Dec 2011
    Posts
    5
    Vote Rating
    0
    swilber1579 is on a distinguished road

      0  

    Default


    Any ideas? This really looks like a bug. I'll add that grid.setAutoWidth(true) makes no difference.