ExtJS Gridpanel列宽度+强制



我有一个gridpanel,我想有2列。我希望第一列的宽度为100,第二列填充gridpanel的剩余宽度。

任何想法?

编辑

sensorListPanel = new xg.GridPanel({
    id: 'sensorListPanel',
    region: 'west',
    width: 415,
    viewConfig: {
        forceFit:true,
        //fitcontainer:true
    },
    store: sensorStore,
    cm: new xg.ColumnModel({
        defaults: {
            width: 120,
            sortable: true
        },
        columns: [
            smSensors,
            {id:'Station',header: "Station", width: 95, dataIndex: 'gml_id'},
            {id:'Description', header: "Description", dataIndex: 'description'}
        ]
    }),
    sm: smSensors,
    columnLines: true,
    title:'Sensors',
});

尝试在viewconfig中设置forceFit

viewConfig:{forceFit:true}

通过指定forceFit:true,非固定宽度列将被重新分配(基于相对初始宽度)以填充网格的宽度。

你可以使用"autoExpandColumn"配置,它出现在网格上。

{
    xtype : 'grid',
    cm : //Your Column model Code,
    autoExpandColumn : COLUMN_NAME_FROM_COLUMN_MODEL
}

在列模型中,可以为固定宽度的列指定宽度。

最新更新