PDA

View Full Version : data.TreeStore and json proxy



fadh
24 Aug 2011, 1:54 AM
Hi,

i want to read a json file into a tree store. But i don' get it right. So here is my code:
The Store with a REST proxy to read the json file:


Ext.define('hrtool.store.BusinessUnitTreeStore', {
extend: 'Ext.data.TreeStore',
proxy: {
type: 'rest',
url: 'http://' + location.host,
api: {
read : '/hrtool/_design/hrtool/_list/bus/businessUnits'
},
reader: {
type: 'json',
root: 'group'
}
}

The delivered json:



{"rows":
[{"_id":"businessUnitTreeStoreData",
"_rev":"306-bb6c9ef54319b993f7762bcb01db22c7",
"group":
{"text":"Zühlke Engineering",
"expanded":true,
"children":[
{"text":"detention","leaf":true},
{"text":"homework","expanded":true,
"children":[
{"text":"book report","leaf":true},
{"text":"alegrbra","leaf":true}]},
{"text":"buy lottery tickets", "leaf":true}
]},
"type":"bu","couchapp":{}}]}


When I'm loading the store, it deliveres nothing. Can anyone help?

Thanks