2017-09-29 1 views
-1

콤보 상자 (자동 완성 기능 포함) 및 원격 저장소를 만들려고합니다. 사용자가 콤보 상자에 문자를 입력하면 서버로 이동하여 새로운 데이터 저장소를 만듭니다. 그리고 콤보 박스에 아무것도 넣지 않습니다. 제 코드가 뭐가 잘못 되었나요? 어떻게해야합니까? 내 콤보 상자에서 일부 문자를 입력 할 때Extjs6.5의 Dynamic Combobox가 작동하지 않습니다.

Ext.define('HDDTest.store.GetRelatedConceptStore', { 
    extend: 'Ext.data.Store', 

    field: ['value', 'text'], 
    alias: 'store.GetRelatedConceptStore', 
    storeId: 'GetRelatedConceptStore', 
    autoSync: true, 
    autoLoad: true, 
    proxy: { 
     type: 'ajax', 
     url: "http://127.0.0.1/api/TSGH/GetAllSearchResults", 
     method: 'GET', 
     reader: { 
      type: 'json', 
      rootProperty: '', 
      transform: function (records) { 
       var data = new Array(); 
       for (var i = 0; i < records.length; i++) { 
        data[i] = new Array(); 
        data[i][0] = records[i].NCID; 
        data[i][1] = records[i].DEFAULT_NAME + '(' + records[i].NCID + ')'; 
       } 
       console.log(data); 
       return data; 
      } 
     } 
    } 
}); 

내가없이 아무것도 얻지 않고 : 여기

Ext.define('HDDTest.controller.main.HomeController', { 
    extend: 'Ext.app.ViewController', 
    alias: 'controller.home', 

    onRelatedConceptComboBoxClicked: function (constructors, text) { 
     var getRelatedConceptStore = Ext.create('HDDTest.store.GetRelatedConceptStore'); 
     getRelatedConceptStore.load({ 
      params: { 
       sValue: 'text' 
      }, 
      callback: function (records, success) { 
      }, 
      scope: this 
     }); 
    } 
}); 

내 상점 : 여기
Ext.define('HDDTest.view.mod.searchDetails', { 
    extend: 'Ext.Panel', 
    controller: 'home', 
    items: [ 
     { 
      xtype: 'combobox', 
      width: 450, 
      id: 'createRelatedConceptComboBox', 
      name: 'createRelatedConceptComboBox', 
      fieldLabel: 'Test', 
      //hideTrigger:true, 
      valueField: 'text', 
      emptyText: 'Select Concept', 
      typeAhead: true, 
      typeAheadDelay: 350, 
      minChars: 1, 
      listeners: { 
       change: 'onRelatedConceptComboBoxClicked' 
      }, 
      store: { 
       type: 'GetRelatedConceptStore' 
      } 
     } 
    ] 
}); 

내 컨트롤러 : 여기

내 콤보입니다 내 콘솔 창에 오류 메시지가 있습니다. 어떻게해야합니까? 사전에 감사합니다, 벤

+0

더 잘 이해하는 데 도움이 될만한 피들을 제공하십시오. – Tejas

답변

0

의 처리에 약간의 오류가 변환 될 것 같다() 방법 또는 displayField 속성에 대한 모델 필드 이름.

Here의 변환 코드 ()가있는 작업 코드입니다.