Dojo Filtering Select: Unable to add options

I cannot add any parameters to my FilteringSelect dijit file.

Here is 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

+3
source share
1 answer

I believe you need to wrap the JSON variable optionsin Dojo ItemFileReadStore.

Can you try something like 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 programming example that uses a local JSON structure. This is the Codependent FilteringSelect Example (the fifth “View Example” button after this link).

+2
source

Source: https://habr.com/ru/post/1732358/


All Articles