あなたはchange
イベントに耳を傾け、あなたが二コンボボックスを有効にしたい任意の値と新しい値を比較することができます:あなた自身に基づいて
{
xtype: 'combobox',
anchor: '100%',
displayField: 'description',
valueField: 'adjustmentTypeId',
fieldLabel: 'A',
// lastQuery: '' to disable store loading a second time on trigger click
lastQuery: '',
bind: {
store: '{a}'
},
listeners: {
change: function(combo, value) {
// Logging a value to console - remove this code
console.log(value);
var store = combo.getStore();
var record = store.findRecord(combo.valueField, value)
var arsubOpen = record.get('arsubOpen');
// Condition for enabling here
var shouldEnable = arsubOpen === 1;
var form = combo.up('form');
var basicForm = form.getForm();
// 'bField' si the name of the B combobox field
var bCombo = basicForm.findField('bField');
bCombo.setDisabled(!shouldEnable);
}
}
},
{
xtype: 'combobox',
anchor: '100%',
// Field name to use for form submitting and finding the field
name: 'bField',
displayField: 'description',
valueField: 'arOnlySubCategoryId',
fieldLabel: 'B',
// lastQuery: '' to disable store loading a second time on trigger click
lastQuery: '',
bind: {
disabled: 'disableB',
store: '{B}'
}
}
fiddleを。
私はlastQuery: ''
の設定を投げて、トリガーのクリックで2回目のロードを無効にしました。これは本当に迷惑になる可能性があり、解決策を理解するのに多くの時間を要しました。
マラシーありがとうございますが、ここで重要な点は、同じレコードの他のパラメータに基づいて有効と無効を切り替えることです。例:\t "arsubOpen": "0" {"adjustmentTypeId":7、 "type": "M"、 "invoiceType": "M"、 "description": "Miscellaneous"、 "createUserId": "9" 1412711611023、 "updateUserId": "21"、 "updateDateTime":1475603316810、 "invoiceCode": "MS"、 "categoryCode": "MS"、 "active":true、 "arsubOpen": "0"}これは、 Miscellaneousのレコードです。だから私はこのレコードをチェックし、 "arsubOpen"が1ならば0または1であるかどうかを確認する必要があります。Bを有効にする必要があります – Sweety
何か他にコンボボックスを使用していますか?そうでなければ、 'valuefield'を' 'arsubOpen''として定義することができます。もしそうなら、 'var record = combo.getStore()。findRecord(combo.valueField、value)'を使うことができます。 – MarthyM
私は同じ感謝を投稿しようとしていたMarthy – Sweety