に私は私が交互に幅の列レイアウト内のコンポーネントの数を持っている状況、すなわち0.75その後、0.25を持っています。宣言のデフォルト値は、コンフィグ
Ext.define('MyApp.view.TestView', {
extend: 'Ext.panel.Panel',
layout: 'column',
items: [{
xtype: 'textfield',
columnWidth: .75
}, {
xtype: 'textfield',
columnWidth: .25,
}, {
xtype: 'textfield',
columnWidth: .75
}, {
xtype: 'textfield',
columnWidth: .25,
}, {
xtype: 'textfield',
columnWidth: .75
}, {
xtype: 'textfield',
columnWidth: .25,
}
]
});
Ext.onReady(function() {
Ext.create('MyApp.view.TestView', {
renderTo: Ext.getBody(),
width: 400
});
});
設定オブジェクトにこれらの2つの値を保存する方法はありますか?私は誰かが幅の変更を望むたびにすべてを変更する必要はありません。デフォルト値を設定することはできません。なぜなら、変更したい値が1つだけではないからです。
私はコンストラクタで設定オブジェクトにこれらの値を適用するには何とか可能かもしれないと考えていた、または私はこのようになります可能な解決策があるかもしれません考えていた。
Ext.define('MyApp.view.TestView', {
extend: 'Ext.panel.Panel',
layout: 'column',
config: {
colWidth1: .75,
colWidth2: .25
}
items: [{
xtype: 'textfield',
columnWidth: 'colWidth1'
}, {
xtype: 'textfield',
columnWidth: 'colWidth2'
}, {
xtype: 'textfield',
columnWidth: 'colWidth1'
}, {
xtype: 'textfield',
columnWidth: 'colWidth2'
}, {
xtype: 'textfield',
columnWidth: 'colWidth1'
}, {
xtype: 'textfield',
columnWidth: 'colWidth2'
}
]
});
Ext.onReady(function() {
Ext.create('MyApp.view.TestView', {
renderTo: Ext.getBody(),
width: 400
});
});
https://fiddle.sencha.com/#fiddle/1ccj