I think that object might work for the filteringselect, but I've only used
it in a DataGrid so far.
data = new dojo.data.ObjectStore(
{ objectStore: new dojo.store.Memory({data:[]}) }
);
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/populate-filteringselect-with-array-tp3013188p3013980.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
________________________________________________________
Dojotoolkit: http://dojotoolkit.org
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api
Tutorials: http://dojotoolkit.org/documentation
Dojo-i...@mail.dojotoolkit.org
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
var myStore = new dojo.data.ObjectStore({
objectStore : new dojo.store.Memory({
data:{
identifier:'value',
label:'label',
items:[
{name:'McDonalds',label:'Mc Donalds',value:'MCD'},
{name:'BurgerKing',label:'Burger King',value:'BK'}
]
}
})
});
var select = new dijit.form.FilteringSelect({id:'mySelect',store:myStore});
var hook = dojo.byId("hook").appendChild(select.domNode);
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/populate-filteringselect-with-array-tp3013188p3014034.html
// Your array
var myData = [
{name:'McDonalds',label:'Mc Donalds',value:'MCD'},
{name:'BurgerKing',label:'Burger King',value:'BK'}
];
// Create the store from the array. You need to add an additional param (the
identifier), and often you might want to add a label too
var store = new dojo.data.ItemFileReadStore({
data: {
identifier: 'name',
label: 'label',
items: myData
}
})
-----
Tom Elliott / mrtom / postoffice
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/populate-filteringselect-with-array-tp3013188p3014360.html
I can't get the code in this example to work. I get two errors
1. hook is null
2. dojo.store is not defined.
Do I have to require something for the memory object store?
Also what's the purpose of the last line. It seems to reference itself?
Thanks,
Dan
You need to require all used dojo classes. In this case:
dojo.require("dojo.store.Memory");
and
dojo.require("dojo.data.ObjectStore");
as well as other widgets as needed.
var hook = dojo.byId("hook").appendChild(select.domNode);
"hook" was just the id of a div that I used to put the widget onto the page.
In the last line I forgot to erease the first part of the statement.
I edited it on the forum, but depending on how you read it, the edit might
not show.
Otherwise its just a way of putting the dijit into the above mentioned
container DIV.
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/populate-filteringselect-with-array-tp3013188p3020094.html
Dan
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/populate-filteringselect-with-array-tp3013188p3020470.html