PDA

View Full Version : How do I load a data array into a data store



howHardCanItBe
5 Sep 2011, 5:08 PM
if I have a data store that holds a single piece of information "email" and I have a array of emails that has just the email information (no JSON) how do I load that information into the data store? I have to be missing something really simple.

urchin
6 Sep 2011, 1:35 AM
Hi,

I would probably try to adapt one of the existing examples.
Here is an extract from one of the touch charts demos:



window.generateData = function(n, floor) {
var data = [],
p = (Math.random() * 11) + 1,
i;

floor = 10;

for (i = 0; i < (n || 12); i++) {
data.push({
name: Date.monthNames[i % 12],
iphone: Math.floor(Math.max((Math.random() * 100), floor)),
android: Math.floor(Math.max((Math.random() * 100), floor)),
ipad: Math.floor(Math.max((Math.random() * 100), floor))
});
}
return data;
};
window.store1 = new Ext.data.JsonStore({
fields: ['name', 'iphone', 'android', 'ipad'],
data: generateData(5, 20)
});

howHardCanItBe
6 Sep 2011, 6:45 AM
I can see the data in the store now no problem when I use chrome console. The data does not show in my template, but I will research that and do some Google, and forum searches and make a separate post if I can't figure out why. Thanks for the assistance.