PDA

View Full Version : Help on reading store correctly



wehr
7 Sep 2011, 7:57 AM
Hi,
I'm trying to set up a Sencha list that read outs a directory.

I already got a php file called (get-file.php) that echos the following:

{"files": [{"file":"Copy (10) of crank.wav","id":2},{"file":"Copy (11) of crank.wav","id":3},{"file":"Copy (12) of crank.wav","id":4}]}
now i tried to get my result listed up with my index.js:

Ext.setup({ tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady : function() {
Ext.regModel('files', {
fields: [
{name: 'files', type: 'string'},
{name: 'id', type: 'string'}
]
});


var groupingBase = {
store: new Ext.data.Store({
model: 'files',
proxy: {
type: 'ajax',
url: 'get-file.php',
reader: {
type: 'json',
root: 'files'
}
},
autoLoad: true
})
};




if (!Ext.is.Phone) {
new Ext.List(Ext.apply(groupingBase, {
floating: true,
width: 350,
height: 370,
centered: true,
modal: true,
hideOnMaskTap: false
})).show();
}
else {
new Ext.List(Ext.apply(groupingBase, {
fullscreen: true
}));
}
}
});




But I'm only getting a blank page. I spend hours on searching my misstake but ended up clueless. Hope someone could give me a hint.
Thanks in advance, Wehr.

wehr
7 Sep 2011, 10:40 AM
Just noticed i posted this in the wrong section :/.
Could any admin please move my thread to the Q&A section of the Sencha Touch forum please?