简体   繁体   中英

Having trouble populating the FilteringSelect (dojo)

I have the following json

{
Name: 
Phone:
Contact:
list:
{
Gender:
[
Male
Female
]
}
}

I am trying to display Gender info in the filtering select. If a user clicks on the filtering select arrow it should display Male, Female(Gender info).

store1 = new dojo.store.Memory({data: a1});  //a1 has list values in it
var f1 = new dijit.form.FilteringSelect({
                    name: "list",
                    placeHolder: "Select gender",
                    store:dojo.data.ObjectStore({ objectStore: store1}) 
                }, "f1");

Please can anyone help me..

Regards.

I think the store has to implement the identity API, which dojo.store.Memory doesn't ( yea the docs show it as the example but it doesn't seem to work).

Try this for store1:

var tdata = {
            identifier:'idd'
            ,label:'name'
            ,items:[
                {idd:'a',name:'Rawr'}
                ,{idd:'b',name:'lok'}
            ]
        };
        var store1 = new dojo.data.ItemFileReadStore({ data: tdata });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM