2014-03-28 2 views
0

안녕하세요, 두 개의 콤보 상자가 있습니다. 두 번째 콤보 상자의 값은 첫 번째 콤보 선택에 따라 다릅니다. 사용자가 첫 번째 콤보를 선택하면 그에 따라 두 번째 저장자가 설정됩니다. 콤보 1콤보 상자에 동적 저장소 설정

items:[ 
     { 
      xtype : 'combo', 
      name : 'cmbSATopFacility', 
      labelStyle : 'color: black; font-weight: bold; width: 250px; padding: 10;', 
      labelSeparator : "", 
      id : 'cmbSATopFacility', 
      width : 250, 
      fieldLabel : 'Top MGMT Entity', 
      triggerAction : 'all', 
      store : Ext 
      .create(
       'Ext.data.Store', 
       { 
       id : 'store', 
       fields : [ 
        { 
        name : 'id', 
        type : 'integer', 
        }, 
        { 
        name : 'name' 
      } ], 
       remoteGroup : true, 
       remoteSort : true, 
       proxy : { 
        type : 'rest', 
        url : 'pmsRest/facilities?sub_facility_id=-3', 
        reader : { 
         root : "facilityMaster", 
         idProperty : 'id' 
      } 
       }, 
      autoLoad : true 
     }), 
     displayField : 'name', 
     valueField : 'id', 
     multiSelect : false, 
     typeAhead : true, 
      listeners : { 
      change : function(combo) { 
       /// code to convert GMT String to date object 
       n(); 
       Ext.getCmp('cmbSAMedFacility').getStore().load(); 
      } 
      }, 
      allowBlank : false, 
      //enableKeyEvents : true, 
    }, 

콤보 저장 var에 medfacility = loadFacility을 설정하는 2

{ 
                  xtype : 'combo', 
                  name : 'cmbSAMedFacility', 
                  labelStyle : 'color:black;font-weight:bold;width:250px;padding:10;', 
                  labelSeparator : "", 

                  id : 'cmbSAMedFacility', 
                  width : 250, 
                  fieldLabel : 'Institution', 
                  triggerAction : 'all', 
                  store : medfacility, 
                  displayField : 'name', 
                  valueField : 'id', 
                  multiSelect : false, 
                  typeAhead : true, 
                  //disabled: true, 
                  listeners : { 
                    click : function(combo) { 
                    alert("hjdfhcsdj"); 
                    n(); 
                    Ext.getCmp(this).getStore().load(); 

                    } 

                   }, 
                  allowBlank : false, 
                  //enableKeyEvents : true, 

                 }, 
                ] 

코드()

; 여기

내 두 콤보입니다

function loadFacility(){ 
    topApp = Ext.getCmp('cmbSATopFacility').getValue(); 
    alert(topApp); 
    var urL = 'pmsRest/facilities?sub_facility_id='+topApp ; 
    alert(urL); 
    var store = Ext.create('Ext.data.Store', { 
         id : 'store', 

          fields : [ 
            { 
             name : 'id', 
             type : 'integer', 
            }, 
            { 
             name : 'name' 
            } ], 
          remoteGroup : true, 
          remoteSort : true, 
          proxy : { 
           type : 'rest', 
           url : urL, 


           reader : { 

            root : "facilityMaster", 
            idProperty : 'id' 
           } 

          }, 
          autoLoad : true 
         }); 
         return store; 
     } 

나는 getvalues in the second combo을 시도했지만 작업을 않았나.

+0

일부 솔루션 –

+0

을 제안하십시오. –

+0

을 명확히하시기 바랍니다. 코드를 들여 씁니다. 이것은 다른 사용자가 당신을 이해하고 도울 수 있도록 도와줍니다 :) –

답변

0
WE CAN USE ONLY 
listeners : {           change : function(combo) { Ext.getCmp('cmbSAMedFacility').bindStore(n());}}, 
0

데이터가 없으면 (빈 배열) 두 번째 콤보 상자의 저장소를 설명해야한다고 생각합니다.
loadData method을 사용하여 필요한 경우 해당 저장소의 데이터를 입력하십시오.

희망이 도움이됩니다.

관련 문제