2016-05-09 11 views
0

これは私の問題です。私はいくつかのオプションを持つselectfieldを持っています。 selectfieldは私のリストをフィルタリングするために使われます。 selectfieldにはDisciplineによるフィルタがあります。ユーザーがそれを選択すると、現在隠されている規律フィールドが表示されますが、ユーザーが学生によってフィルタを選択すると、ディスパインフィールドは非表示になり、代わりに学生フィールド(非表示にもなります)が表示されます。しかし、私はコードを理解していないようです。 Btw、私はsencha touchの新人です。私はsencha touch 2.4.2を使用しています。ここに私のコードです: -Sencha Touchでselectfieldの条件付きリスナーを行う方法

{ 
         //first item of vbox(1) 
         xtype: 'container', 
         layout: 'hbox', 
         style: 'background-color:' + _ListHeaderColor() + '; color: floralwhite;', 
         margin: '10 10', 
         items: [ 
          { 
           //first item of hbox 
           html: "Request List (Request Patient)", 
           margin: '15 15', 
           flex: 1 
          }, //end of first item of hbox 
          { 
           //second item of hbox 
           xtype: 'selectfield', 
           id: 'choose', 
           name: 'filter', 
           label: 'Filter By', 
           margin: '5 5', 
           width: '20%', 
           options: [ 
              { text: '-', value: 'none' }, 
              { text: 'Discipline', value: 'disc' }, 
              { text: 'Student', value: 'stud' }, 
           ], 
          listeners: { 
           change: function (field, newValue) { 
            if (value) { 
             var disp = Ext.getCmp(newValue).show(); 
             var disp = Ext.getCmp(newValue).hide(); 
            } 
            else { 
             var disp = Ext.getCmp(newValue).show(); 
             var disp = Ext.getCmp(newValue).hide(); 
            } 
           } 
          } 
         }, 
         { 
          xtype: 'selectfield', 
          id: 'disc', 
          name: 'discipline', 
          label: 'Discipline', 
          margin: '5 5', 
          hidden: true, 

          store: _DataStore_RequestPatient, 
          displayField: 'text', 
          valueField: 'value' 
         }, 
         { 
          xtype: 'searchfield', 
          id: 'stud', 
          name: 'student', 
          label: 'Students', 
          hidden: true 
         } 
        ] 
       }, 

答えて

0

まあ、あなたが得るエラーメッセージを提供する必要があります。あなたは

値は

を定義したが、これは氷山の一角であるされていないことが判明している必要があります。礼儀正しく、あなたのコードを修正しました。

https://fiddle.sencha.com/#fiddle/1a1h

+0

大変ありがとうございます!私はずっとずっと固まってきた。それがあなたのやり方です。どうもありがとうございます。あなたに深く感謝します。 – Fareez

関連する問題