您可以添加监听器combobox
和监听事件的开始日期。 datefield
change( this, newValue, oldValue, eOpts )
然后检查是否选择combobox
了开始日期 datefield
。如果它对您的服务器具有真正的影响并ajax.request
为您的结束日期带来价值datefield
这是一个示例,说明了许多解决方案之一(而不是伪代码):
看法
Ext.define('YourPanel', {
extend: 'Ext.panel.Panel',
alias: 'widget.yourPanel',
xtype: 'yourPanel',
items:[{
xtype: 'combobox',
itemId: 'approachCountId'
},{
xtype: 'datefield',
itemId: 'dateStartId'
},{
xtype: 'datefield',
itemId: 'dateEndId'
}]
});
控制器
Ext.define('YourController', {
extend: 'Ext.app.Controller',
init: function () {
var controller = this;
controller.control({
'yourPanel combobox#approachCountId': {
change: controller.changeEndDateValue
},'yourPanel combobox#dateStartId': {
change: controller.changeEndDateValue
}
})
},
changeEndDateValue: function(field, newValue, oldValue, eOpts){
var controller = this;
//YourCode here to check if combobox value and end date value are not empty.
if(!Ext.isEmpty(startDateField) && !Ext.isEmpty(approachCount)){
//Ajax call
Ext.Ajax.request({
method: 'POST',
url: 'yourUrlToCheck',
params: {
approachCount: approachValue,
startDate: startDateValue
},
scope: this,
success: function (result, response) {
//if success set value to End Date datefield
},
failure: function (result, response) {
}
});
}
}
});