3

予約するためのドロップダウンが 2 つあります。1つは「時間から」であり、もう1つは「時間まで」です。ドロップダウンには、たとえば次のスロットがあります。午前 9 時から午前 11 時までと午後 1 時から午後 3 時までなので、午前 9 時から午後 11 時までの 1 番目のスロットを選択すると、[時間まで] ドロップダウンで、1 番目のスロットで予約できる時間しか表示されません。 9.15 、10.15 など。つまり、= 9.15 から = 10.15 までの予定を選択しました。ここで [from time] ドロップダウンをクリックすると、利用可能なスロットがすべて表示され、ここでは何も変更しませんが、[to time] ドロップダウンをクリックすると、予期しないすべてのスロット タイミングが表示されます。私は変更を加えていないので、変更を加えるかどうかにかかわらず、期待される動作は「時間から」ドロップダウンに従ってフィルターを適用する必要があります。

以下は私のコードです

{
        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 に基づいてフィルターを適用しています。また、時刻からすべてのスロットを「時刻から」ドロップダウンに表示したいので、フィルターを削除しています。

4

1 に答える 1

2

私は答えを得ました。それは今働いています。

{
        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);
            }
          }
        }]
      }

「to time」ドロップダウンのフォーカスイベントにフィルターを適用すると、期待どおりに機能することがわかりました。

于 2013-10-10T12:18:23.977 に答える