2011-09-23 2 views
1

방금 ​​다른 게시물을 입력하고 중간에 문제를 파악했습니다. 다시 일어날 지 봅시다.ExtJS : ComboBox의 요소를 프로그래밍 방식으로 바꾸기

주어진 드롭 다운이 선택되면 다른 드롭 다운을 업데이트 할 수 있어야합니다. 내 문제는 보조 드롭 다운이 처음으로로드되지 않는다는 것입니다. 페이지에서 아무 것도 일어나지 않습니다. 사용자가 동일한 요소를 두 번 선택하면 모든 것이 올바르게 작동합니다.

나는 프로그래밍 방식으로 선택 상자의 무리를 생성하고 있습니다 :

var item = new Ext.form.ComboBox({ 
         store: store, 
         id: input.id, 
         name: input.id, 
         displayField: 'description', 
         valueField: 'id', 

         mode: 'local', 
         forceSelection: true, 
         triggerAction: 'all', 
         emptyText: 'Select one...', 
         typeAhead: false, 
         editable: true, 
         allowBlank: allowBlank, 
         selectOnFocus:true, 
         fieldLabel: input.label, 
         listeners: { 
          scope: this, 
          'select': checkDependencies 
         }, 
         autoHeight: true 
        }); 

내 문제가 발생 내가 아래로 종속 드롭을 업데이트하려고하면. 다음은 사용자가 옵션을 선택할 때 호출되는 함수입니다.

function checkDependencies(el, ev){ 
    debug(el); 
    debug(el.value); 
    var val = el.value; 
    if (Ext.isArray(dependencies[val])) { 
     var id = dependencies[val]['changeId']; 
     var input = Ext.getCmp(id); 
     var vals = dependencies[val]["vals"]; 
     input.store.removeAll(); 
     gridForm.doLayout(); 
     debug("num elements: " + vals.length); 
     input.autoHeight = true; 
     for (var i=0;i<vals.length;i++) { 
      input.store.add(vals[i]); 
     } 
     gridForm.doLayout(false,true); 
    } 
} 

모든 디버그 라인에 충돌합니다. 목록에 요소가 있지만 처음 설명한 것처럼 사용자가 요소를 선택하면 작동하지 않지만 이후 선택은 정상적으로 작동합니다.

나는 doLayouts eveywhere를 놓았지만, 도움이되지 않았다.

답변

2

보조 상자에 queryMode: 'local'을 설정하고 checkDependenciesinput.lastQuery = ''을 설정해보십시오.

+0

* headdesk * 그래 - 그랬어. 감사. – jeffkolez

관련 문제