Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extjs 3.3.1 FieldSet with layout fit and grid in it does not resize the grid on window resize

var colModel = new Ext.grid.ColumnModel({
      columns: [ columns here...]
})

var grid = new Ext.Ext.grid.GridPanel({
   store: store,
   loadMask: true,
   autoExpandColumn: 'itemDescription',
   stripeRows: true,
   colModel: colModel
})

var form = new Ext.FormPanel({
   labelWidth: 150,
   bodyStyle: 'padding:2px 5px;',
   autoScroll: true,
   items:[
     new Ext.form.FieldSet({
       layout: 'fit',
       collapsible: true,
       height:300,
       items: [
            grid 
       ]
     }
   ]
})

The grid does not change its width once the window gets resized... Any thoughts???

like image 690
AMember Avatar asked Apr 19 '12 06:04

AMember


2 Answers

Your Grid will resize according to the FieldSet due to layout: 'fit'. Since the FormPanel doesn't have a layout set, it automatically uses layout: 'form'. The FieldSet will act as a normal Form Field and thus needs to be configured to resize it self. This can be done using the anchor property of the FormLayout:

var form = new Ext.FormPanel({
    labelWidth: 150,
    bodyStyle: 'padding:2px 5px;',
    autoScroll: true,
    items:[
        new Ext.form.FieldSet({
            layout: 'fit',
            anchor: '-0',
            collapsible: true,
            height:300,
            items: [
                grid 
            ]
        }
    ]
});

This will tell the FieldSet to always stay 0 pixels from the right edge of the FormPanel.

like image 200
Chau Avatar answered Oct 28 '22 06:10

Chau


try this.....

var colModel = new Ext.grid.ColumnModel({
  columns: [ columns here...]
})

var grid = new Ext.Ext.grid.GridPanel({
store: store,
loadMask: true, 
autoExpandColumn: 'itemDescription',
stripeRows: true,
colModel: colModel
})

var form = new Ext.FormPanel({
labelWidth: 150,
bodyStyle: 'padding:2px 5px;',
autoScroll: true,
items : {
   xtype : 'fieldset',
   title : 'Give proper Title',
   defaults: {
      anchor: '100%'
   },
   layout: 'anchor',
   collapsible: true,
   items: grid
}
});
like image 1
Snehal Dangroshiya Avatar answered Oct 28 '22 08:10

Snehal Dangroshiya