2010-02-11 7 views
3

FilteringSelect dijit에 옵션을 추가 할 수 없습니다.Dojo FilteringSelect : 옵션을 추가 할 수 없음

var options = { 
     identifier: 'abbr', 
     label: 'name', 
     items: [{ 
      abbr: 'ec', 
      name: 'Ecuador', 
      capital: 'Quito' 
     }, 
     { 
      abbr: 'eg', 
      name: 'Egypt', 
      capital: 'Cairo' 
     }, 
     { 
      abbr: 'sv', 
      name: 'El Salvador', 
      capital: 'San Salvador' 
     }, 
     { 
      abbr: 'gq', 
      name: 'Equatorial Guinea', 
      capital: 'Malabo' 
     }, 
     { 
      abbr: 'er', 
      name: 'Eritrea', 
      capital: 'Asmara' 
     }, 
     { 
      abbr: 'ee', 
      name: 'Estonia', 
      capital: 'Tallinn' 
     }, 
     { 
      abbr: 'et', 
      name: 'Ethiopia', 
      capital: 'Addis Ababa' 
     }] 
    }; 


var headerSelect = new dijit.form.FilteringSelect({ 
name: 'test', 
id: 'widgetHeaderSelect', 
store: options 
}, 'widgetHeaderSelectDiv'); 

어떤 아이디어 :

여기 내 코드입니까? 감사 : D

답변

2

Dojo ItemFileReadStore 내에서 JSON options 변수를 래핑해야한다고 생각합니다.

다음과 비슷한 것을 시도해 볼 수 있습니까?

var headerSelect = new dijit.form.FilteringSelect(
    { name: 'test', id: 'widgetHeaderSelect', 
     store: new dojo.data.ItemFileReadStore({ data: options }) }, 
     'widgetHeaderSelectDiv'); 

Dojo 캠퍼스에는 로컬 JSON 구조를 사용하는 프로그래밍 방식의 예제가 있습니다. Codependent FilteringSelect Example입니다 (해당 링크를 따른 후 다섯 번째 "예제보기"버튼).

관련 문제