Đinh Hồng Châu
Đinh Hồng Châu

Reputation: 5430

How to set minimum width for Ext.grid.Column?

is it possible to set the minimum width for an Ext.grid.Column? The column can be resized and "fixed" config is false. Could you please help me? Thank you very much.

Upvotes: 2

Views: 7908

Answers (2)

NT3RP
NT3RP

Reputation: 15370

Yes, there is a config property of the grid called minColumnWidth. However, this will set a minimum for all columns, not just one specific column. In order to enforce a minimum width on specific columns, you'll likely need to extend or override some methods in Ext.grid.GridView

Upvotes: 3

Abdel Raoof Olakara
Abdel Raoof Olakara

Reputation: 19353

The Grid column does not have a minWidth property.The width property does behave as a minWith when the fixed property is set to false. So, you will have to have your configured as such:

{
    header: 'Name (English)',
    dataIndex: 'name_en',
    sortable: true,
    width: 150
}

The width being set to 150 ensures that you have a width of 150 pixels. And since I do not have the fixed set to true, I will be able to expand the column width. If you remove the width property, the column will display with a width of largest data element for that column.

Upvotes: 3

Related Questions