我在表单中有3个输入字段,并且只有在前两个输入具有值时才启用第三个输入.
这似乎不起作用:
Ext.define('MyApp.view.myobj.MyPanel', { extend:'Ext.Panel', viewModel: {}, items: [{ xtype: 'form', defaultType: 'textfield', items: [ {fieldLabel: 'Field 1', reference: 'field1', publishes: 'value'}, {fieldLabel: 'Field 2', reference: 'field2', publishes: 'value'}, { fieldLabel: 'Field 3', bind: { disabled: '{!field1.value} || {!field2.value}' } }, ], }], });
小提琴
在视图模型中,添加公式以返回{!field1.value} ||的值 {!field1.value}
按照小提琴:
viewModel: { formulas: { something: { bind: { x: '{!field1.value}', y: '{!field2.value}' }, get: function (data) { if (data.x || data.y) return true; else return false; } } } }, items: [{ xtype: 'form', defaultType: 'textfield', bodyPadding: 10, items: [ {fieldLabel: 'Field 1', reference: 'field1', publishes: 'value'}, {fieldLabel: 'Field 2', reference: 'field2', publishes: 'value'}, { fieldLabel: 'Field 3', bind: { disabled: "{something}" } }, ], }]