tags:

views:

452

answers:

1

I can't add any options to my FilteringSelect dijit.

Here's my code:

 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');

Any ideas? Thanks :D

+1  A: 

I believe you need to wrap your JSON options variable within a Dojo ItemFileReadStore.

Can you try something similar to the following?

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

Dojo Campus also has a programmatic example that uses a local JSON structure. It is the Codependent FilteringSelect Example (the fifth "View Example" button after following that link).

Abboq