グリッドオブジェクトにforceFit : true
設定を指定できます。
Ext.create('Ext.data.Store', {
storeId: 'simpsonsStore',
fields: ['name', 'email', 'phone'],
data: [{
name: 'Lisa',
email: '[email protected]',
phone: '555-111-1224'
}, {
name: 'Bart',
email: '[email protected]',
phone: '555-222-1234'
}, {
name: 'Homer',
email: '[email protected]',
phone: '555-222-1244'
}, {
name: 'Marge',
email: '[email protected]',
phone: '555-222-1254'
}]
});
Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
forceFit : true,
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [{
text: 'Name',
dataIndex: 'name'
}, {
text: 'Email',
dataIndex: 'email',
flex: 1
}, {
text: 'Phone',
dataIndex: 'phone'
}],
height: 500,
width: 600,
renderTo: Ext.getBody()
});
なぜすべての列にフレックスを付けることができないのですか?または、フレックスを一括して削除し、autoWidthを使用してください。 – BhandariS
@BhandariS実際には、コンテンツに基づいてサイズ変更されるたびに、すべての列にflexプロパティを使用したくありません。 autoWidthは列見出しの幅またはセル幅自体で計算されますか? – bash0ne