Hello,
Im a freshman in json and sencha framework.
I am working on an app and at first i want to get Data from our webservice and display it in a gridview.
But i get this error " Cannot read property 'length' of undefined".
This is the output of the PHP:
Code:
[{"id":"198","product_id":"15","NAME":"Markenjodsalz","amount":"250","UNIT":"g","quantaty":"1"},{"id":"220","product_id":"48","NAME":"Magarine","amount":"500","UNIT":"g","quantaty":"2"},{"id":"209","product_id":"49","NAME":"H fettarme Milch","amount":"1","UNIT":"Liter","quantaty":"1"},{"id":"218","product_id":"87","NAME":"Milchschnitte","amount":"4","UNIT":"St","quantaty":"1"},{"id":"217","product_id":"153","NAME":"Mixery","amount":"1","UNIT":"Flasche","quantaty":"1"},{"id":"219","product_id":"173","NAME":"Gouda gerieben","amount":"200","UNIT":"g","quantaty":"1"}]
And i took the example-code from the api-documentation:
Code:
Ext.regModel('User', {
fields: [
{name: 'id', type: 'int'},
{name: 'product_id', type: 'int'},
{name: 'amount', type: 'int'},
{name: 'quantaty', type: 'int'},
'NAME', 'UNIT'
]
});
var myStore = new Ext.data.Store({
model: 'User',
proxy: {
type: 'ajax',
url : '*****/iphone/shoppinglist.php',
reader: {
type: 'json',
root: 'users'
}
},
autoLoad: true
});
Don't know what i am doing wrong.
Thanks for help