我有两个下拉菜单可以预约。一个是“从时间开始”,另一个是“从时间开始”。在下拉列表中有例如的插槽。上午9点至上午11点以及下午1点至下午3点,因此,当我选择一个上午9点至晚上11点的第一个时段时,在“到时间”下拉列表中,我只能看到可用的时间在第一个时段预定约会,即9.15,10.15等。因此,我现在从9.15到= 10.15中选择了一个约会。现在,我单击“从时间”下拉列表,我可以看到所有可用的插槽,并且在这里我没有做任何更改,但是当我单击“至时间”下拉列表时,我可以看到所有的插槽时序,这是意外的我没有进行任何更改,因此即使我没有进行任何更改,也应该按照“从时间”下拉列表应用预期的行为进行过滤。
以下是我的代码
{
xtype: 'selectfield',
name: 'fromTime',
id: 'fromTime',
placeHolder: 'Select From Time',
label: 'From:',
labelWrap: true,
store: 'DoctorLocationTimes',
displayField: 'fromTime',
valueField: 'fromTime',
listeners: [
{
event: 'change',
fn: function(){
var fromTime, timeStore, index, record, docLocationid;
fromTime = Ext.getCmp('fromTime').getValue();
timeStore = Ext.getStore('DoctorLocationTimes');
timeStore.clearFilter();
index= timeStore.find('fromTime', fromTime);
if(index != -1){
record = timeStore.getAt(index);
docLocationid = record.get('docLocationWorkingHourid');
timeStore.filter('docLocationWorkingHourid',docLocationid);
}
}
},
{
event:'focus',
fn: function(){
var store = Ext.getStore('DoctorLocationTimes');
store.clearFilter();
}
}
]
}
如您所见,我正在基于“ from time” id应用过滤器,并且再次删除过滤器,因为再次在time from中,我想显示“ from time”下拉列表中的所有广告位。
我得到了答案。它现在可以工作了。
{
xtype: 'selectfield',
name: 'toTime',
id: 'toTime',
placeHolder: 'Select To Time',
label: 'To:',
labelWrap: true,
store: 'DoctorLocationTimes',
displayField: 'toTime',
valueField: 'toTime',
listeners: [
{
event:'focus',
fn: function(){
var fromTime, timeStore, index, record, docLocationid;
fromTime = Ext.getCmp('fromTime').getValue();
timeStore = Ext.getStore('DoctorLocationTimes');
timeStore.clearFilter();
index= timeStore.find('fromTime', fromTime);
if(index != -1){
record = timeStore.getAt(index);
docLocationid = record.get('docLocationWorkingHourid');
timeStore.filter('docLocationWorkingHourid',docLocationid);
}
}
}]
}
我发现在对“到时间”的焦点事件应用过滤器后,其工作将按预期下降。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句