Extjs 3.3.1具有布局拟合的FieldSet和其中的网格不会在窗口大小调整时调整网格大小

AMe*_*ber 5 javascript extjs extjs3

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 
       ]
     }
   ]
})
Run Code Online (Sandbox Code Playgroud)

一旦窗口调整大小,网格不会改变其宽度...任何想法???

Cha*_*hau 4

您的意愿Grid会根据 的原因调整大小。由于没有设置布局,它会自动使用. 它将作为正常的,因此需要配置为自行调整大小。这可以使用以下属性来完成:FieldSetlayout: 'fit'FormPanellayout: 'form'FieldSet Form FieldanchorFormLayout

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 
            ]
        }
    ]
});
Run Code Online (Sandbox Code Playgroud)

这将告诉FieldSet始终与 的右边缘保持 0 像素距离FormPanel