PDA

View Full Version : It is possible to generate a Model from Json.



lutinwood
4 May 2011, 6:01 AM
Hi,

I would like to get my model field from a Json structure. It is possible ?
I use this kind of json format:

//My.json sample
{
"2010-02-15": {
"OR": "100",
"Argent": "75",
"Petrole": "50",
"Cuivre": "25",
"Gaz": "10"
},
Should I generate my js file myself or there is any method to get for example :
"2010-02-15": as field value.
"OR": as field name

in fact I want to know if there is any way to get my model straight into my store.

var store = new Ext.data.Store({
model: getItBy('myjson'), <--------------------Something like that !!
proxy: {
type: 'ajax',
url : 'my.json',
reader: {
type: 'json'
}
}


Thanks ...
Jerry

Jack9
4 May 2011, 5:01 PM
I know it's possible with eval() *ducks*