5
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 
       ]
     }
   ]
})

调整窗口大小后,网格不会改变其宽度......有什么想法吗???

4

2 回答 2

4

Grid将根据FieldSet到期调整大小layout: 'fit'。由于FormPanel没有布局集,它会自动使用layout: 'form'. 将FieldSet充当法线 Form Field,因此需要配置为自行调整大小。这可以使用 的anchor属性来完成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 
            ]
        }
    ]
});

这将告诉FieldSet始终保持距FormPanel.

于 2012-04-19T08:11:10.457 回答
1

试试这个.....

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
}
});
于 2014-01-01T07:32:41.953 回答