2013-11-15 2 views
0

observableArray로 설정된 데이터 소스로 igComboBox를 만들었습니다. 배열에 항목을 추가 할 때 self.datasource : sourceListArray()를 명시 적으로 설정할 필요없이 콤보 상자의 데이터 소스가 자동으로 새 값을 가져 오도록합니다. 이것을 어떻게 할 수 있습니까?녹아웃으로 IgniteUI 콤보 상자 데이터 소스 업데이트

self.sourceListArray = ko.observableArray(); 

    $("#dataSource").igCombo({ 
     allowCustomValue: false, 
     showDropDownButton: true, 
     enableClearButton: false, 
     dataSource: self.sourceListArray(), 
     nullText: "Select Data Source", 
     selectionChanged: self.dataSourceChanged 
    }); 

    function PopulateSourceList(sourceList) { 

     for (var i = 0; i < sourceList.length; i++) { 
      self.sourceListArray.push(sourceList[i].ServiceName); 
     } 
     $("#dataSource").igCombo({ dataSource: self.sourceListArray() }); //don't want this 
    } 

답변

2

현재 샘플 정말 Knockout support for the Ignite UI Combo를 사용하지 않습니다. 이 샘플을 KnockoutJS Binding으로 보아 비교해 보면 콤보를 기본 방식으로 초기화하고 Knockout 바인딩 프로세스 (처리기가 실행되는 곳)를 거치지 않는 것이 좋습니다.

<div id="dataSource" data-bind="igCombo: { 
       allowCustomValue: false, 
       showDropDownButton: true, 
       enableClearButton: false, 
       dataSource: self.sourceListArray(), 
       nullText: 'Select Data Source', 
       selectionChanged: self.dataSourceChanged 
       }"></div> 

을 그리고 모든 것이 작동합니다 - http://jsfiddle.net/damyanpetev/athF2/

이 같은 콤보를 정의 - 해결책은 간단하다
관련 문제