Affichage des articles dont le libellé est VERY SIMPLE Tree store. Afficher tous les articles
Affichage des articles dont le libellé est VERY SIMPLE Tree store. Afficher tous les articles

lundi 2 mars 2015

VERY SIMPLE Tree store

Hi guys,

I have looked around but I still don't understand how to create treestore properly.

I have this very simple json that I get from a server:



Code:



{
"Results": [
{
"name": "John",
"age": 23,
"cars": [
{
"name": "Clio",
"brand": "Renault"
},
{
"name": "Class S",
"brand": "Mercedes"
}
]
},
{
"name": "Michel",
"age": 42,
"cars": [
{
"name": "Qashqai",
"brand": "Nissan"
}
]
}
]
}

I have my two models:


Code:



Ext.define('Person', {
extend: 'Ext.data.Model',
fields: [ 'name', 'age']
});


Ext.define('Car', {
extend: 'Ext.data.Model',
fields: [ 'name', 'brand']
});

Now I know that I have to create a tree store, but in all example that I have seen, there is always a "children" property in the json, which I don't have.

How to create a tree store with the following json?


Thanks a lot in advance !!






VERY SIMPLE Tree store