ExtJS Gridpanel Column width + forcefit

15,386

try setting forceFit in viewconfig

viewConfig:{forceFit:true}

By specifying forceFit:true, non-fixed width columns will be re-proportioned (based on the relative initial widths) to fill the width of the grid.

Share:
15,386
gberg927
Author by

gberg927

Updated on June 04, 2022

Comments

  • gberg927
    gberg927 almost 2 years

    I have a gridpanel that i would like to have 2 columns in. I want the first column to have a width of 100 and the second column to fill the remaining width in the gridpanel.

    Any ideas?

    EDIT

    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',
    });
    
  • gberg927
    gberg927 over 12 years
    When I do that, the columns are divided in 2 and evenly spread out. Please see the code I just posted. Thanks!!!
  • MMT
    MMT over 12 years
    remove width from defaults config of column model
  • AtmiyaDas2014
    AtmiyaDas2014 almost 10 years
    hello MMT,i am try in framework version 5.0.1 but not working