2016-04-11 3 views
0

私はコンボでアイテム(データストア)をAutoLoad:trueでロードしようとしていますが、私はこのことを正しく行っているかどうかわかりません。私は少し初心者ですExtjs、だから、失礼しないでください、heheComboboxはautoLoadを無視します。

ここにコードです!

items: [{ 
       xtype: 'form', 
       padding: 20, 
       name: 'formReplyParameters', 
       layout: 'anchor', 
       fieldDefaults: { 
        msgTarget: 'under', 
        labelAlign: 'top' 
       }, 
       defaults: { 
        padding: 10 
       }, 
       items: [{ 
        xtype: 'checkboxfield', 
        name: 'interactive', 
        inputValue: true, 
        fieldLabel: 'Interactive', 
        anchor: '100%' 
       }, { 
        xtype: 'textfield', 
        name: 'timeResponse', 
        fieldLabel: 'Time response', 
        anchor: '100%' 
       }, { 
        xtype: 'combobox', 
        fieldLabel: 'Alert channel', 
        name: 'uuidResponseParameterType', 
        queryMode: 'local', 
        store: new Ext.data.Store({ 
         fields: [{ 
          name: 'description', 
          type: 'string' 
         }, { 
          name: 'name', 
          type: 'string' 
         }, { 
          name: 'uuid', 
          type: 'string' 
         }], 
         autoLoad: true, 
         hideTrigger: true, 
         minChars: 1, 
         triggerAction: 'query', 
         typeAhead: true, 
         proxy: { 
          type: 'ajax', 
          url: "../blabla", 
          actionMethods: { 
           create: "POST", 
           read: "POST", 
           update: "POST", 
           destroy: "POST" 
          }, 
          extraParams: { 
           action: "catalog", 
           catalog: "parametersType", 
           params: JSON.stringify({ 
            uuidToken: Ext.connectionToken 
           }) 
          }, 
          reader: { 
           type: 'json', 
           root: 'List' 
          }, 
          listeners: { 
           exception: function(proxy, response, operation, eOpts) { 
            var responseArray = JSON.parse(response.responseText); 
            Ext.Notify.msg(responseArray.message, { 
             layout: "bottomright", 
             delay: 5000, 
             type: "error" 
            }); 
           } 
          } 
         } 
        }), 
        anchor: '100%', 
        typeAhead: true, 
        triggerAction: 'all', 
        valueField: 'uuid', 
        displayField: 'description', 
        allowBlank: false, 
        listeners: { 
         change: function (combo, value) { 
          var type = combo.valueModels[0].data.name; 
          var channel = me.down('[name="uuidChanel"]'); 
          channel.clearValue(); 
          var channelStore = new Ext.data.Store({ 
           fields: [{ 
            name: 'description', 
            type: 'string' 
           }, { 
            name: 'name', 
            type: 'string' 
           }, { 
            name: 'uuid', 
            type: 'string' 
           }], 
           autoLoad: true, 
           hideTrigger: true, 
           minChars: 1, 
           triggerAction: 'query', 
           typeAhead: true, 
           proxy: { 
            type: 'ajax', 
            url: "../handler/custom/customEvent.ashx", 
            extraParams: { 
             action: "catalog", 
             catalog: type, 
             params: JSON.stringify({ 
              uuidToken: Ext.connectionToken 
             }) 
            }, 
            reader: { 
             type: 'json', 
             root: 'list' 
            }, 
            listeners: { 
             exception: function(proxy, response, operation, eOpts) { 
              var responseArray = JSON.parse(response.responseText); 
              Ext.Notify.msg(responseArray.message, { 
               layout: "bottomright", 
               delay: 5000, 
               type: "error" 
              }); 
             } 
            } 
           } 
          }); 
          channelStore.load(); 
          channel.bindStore(channelStore); 
         } 
        } 
       }, { 
        xtype: 'combo', 
        name: 'uuidChanel', 
        fieldLabel: 'Channel', 
        valueField: 'uuid', 
        displayField: 'description', 
        anchor: '100%', 
        store: null, 
        allowBlank: false 
       }] 
      }] 

問題はコンボである:uuidChannel 誰が助けることができれば、どうもありがとう!

+0

'name: 'uuidChanel'が' store:null'で設定されているコンボ... –

+0

@SergeyNovikovは私を 'store:null'なしで何度も試してみましたが、何も起こりません。 – Diego

+0

ああ、申し訳ありませんが、慎重に全コードをチェックしませんでした。 –

答えて

0

autoLoad: trueは正確になぜ動作すると思いますか?最後のコンボボックスのピッカーを開いてみると、まだロードされていますか?あなたはストアを作成する必要があり、私はあなたの問題は新店舗が毎回コンボname: 'uuidResponseParameterType'changeイベントトリガーとストアautoLoad: trueを作成したことだと思います

ストアのloadメソッドが自動的に作成

後に呼び出されることを意味しますコンボchangeイベントで新しいextraParamsでロード(またはローカルにフィルタリング)してください。

+0

Woops、私は本当にheheを意味するのか分かりませんが、私はそれを修正しました! – Diego

0

物は、(愚か)

channel.clearValue()です。

このフィールドはすべて問題を起こしていました。私は「UUID」のデータを削除、それはそう、私は私が新しいデータを置くと思います

channelStore.load(); 
channel.bindStore(channelStore); <<< 

に「バインド」と私に新しいデータを返していましたと考えられているため、この「clearValue」がありましたしかし、この "clearValue"は、私がダウンしていた "バインド"でデータを消去していました。だから、私はちょうどそのchannel.clearValue();を排除し、それは問題を解決する! :)

+0

コードサンプル 'clearValue()'がストア 'autoLoad'とは関係がないため、実際にあなたが" combobox ignores autoLoad "の下に何を意味するのかを完全に混乱させました...あなたの質問を更新してください。問題?後で私の答えを更新して、コードの実際の問題を表示してください。 –

+0

よく@SergeyNovikov、まず、申し訳ありませんが、あなたの答えが遅すぎます。私は2つの 'コンボボックス(combobox) 'を持っていて、2番目にはデータがありませんが、最初にデータがあるので、最初のコンボのために渡されたデータを2番目のコンボに変更する' change'関数があります、そして 'autoLoad:true'は最初の' combo'のために渡されたデータを2番目にロードするべきですが、前にも述べたように、 'clearValue();'は私のデータ(データこれが2番目のコンボに渡されたときの最初のコンボの)。あなたが理解すればわかりませんが、それだけです! – Diego

関連する問題