ExtJS Windowでは、設定値を変更した後にupdateLayout
メソッドを使用できます。
updateLayoutこのコンポーネントのレイアウトを更新します。この更新がこのコンポーネントownerCtに影響する場合、代わりにそのコンポーネントのupdateLayoutメソッドが呼び出されてレイアウトを実行します。それ以外の場合は、このコンポーネント(およびその子アイテム)だけがレイアウトされます。
ここではsencha fiddleデモを作成しました。それはどのように動作しているかを示します、これはあなたの問題を解決するか、あなたの要件を達成するのに役立つことを願っています。
Ext.create('Ext.window.Window', {
title: 'Hello',
minWidth: 400,
minHeight: 300,
layout: 'vbox',
items: [{ // Let's put an empty grid in just to illustrate fit layout
xtype: 'grid',
flex: 1,
width: '100%',
border: false,
store: {
fields: ['name', 'email', 'phone'],
data: {
'items': [{
'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"
}]
},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
},
columns: [{
text: 'Name',
dataIndex: 'name'
}, {
text: 'Email',
dataIndex: 'email',
flex: 1
}, {
text: 'Phone',
dataIndex: 'phone'
}],
}, {
xtype:'button',
text: 'Update min height and width with Random Number',
height: 40,
margin: 10,
width:'100%',
renderTo: Ext.getBody(),
handler: function() {
/**
* Returns a random integer between min (inclusive) and max (inclusive)
* Using Math.round() will give you a non-uniform distribution!
*/
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
var num = getRandomInt(300, 600),
wind = this.up('window');
wind.minHeight = num;
wind.minWidth = num;
wind.updateLayout();
}
}]
}).show();
いくつかの扇子を作成してください。 – Tejas