Sencha touch 如何在sencha中单击下拉菜单应用过滤器
我有两个下拉列表来预约。一个是“从时间”,另一个是“到时间”。在下拉列表中,有上午9点到上午11点和下午1点到下午3点的时段,因此当我选择上午9点到晚上11点的第一个时段时,在“到时间”下拉列表中,我只能看到在第一个时段预定约会的可用时间,即9.15、10.15等。因此,现在我选择了从=9.15到=10.15的约会。现在我点击“从时间”下拉列表,我可以看到所有可用的插槽,我在这里不做任何更改,但当我点击“到时间”下拉列表时,我可以看到所有插槽计时,这是意外的,因为我没有做任何更改,所以预期的行为应该是过滤器应该按照“从时间”应用即使我是否做了任何更改,也请下拉 下面是我的代码Sencha touch 如何在sencha中单击下拉菜单应用过滤器,sencha-touch,Sencha Touch,我有两个下拉列表来预约。一个是“从时间”,另一个是“到时间”。在下拉列表中,有上午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();
}
}
]
}
正如您所看到的,我正在根据“从时间”id应用筛选器。我再次删除筛选器,因为在“从时间”中,我希望在“从时间”下拉列表中显示所有插槽。我得到了答案。它正在工作
{
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);
}
}
}]
}
我发现,在对“到时间”下拉菜单的焦点事件应用过滤器后,其工作情况与预期一致