[FIXED-583] nested xml / complex xml, cant get associations to work
Hi all,
There are users who can have books. so I came up with the following simple XML.
PHP Code:
<?xml version="1.0" encoding="ISO8859-1" ?>
<users>
<user>
<userid>1</userid>
<username>Mickey Mouse</username>
<books>
<book>
<bookname>book a</bookname>
<pages>723</pages>
<score>55</score>
</book>
<book>
<bookname>book b</bookname>
<pages>434</pages>
<score>86</score>
</book>
<book>
<bookname>book c</bookname>
<pages>123</pages>
<score>37</score>
</book>
</books>
</user>
</users>
And the following method for loading the users and books in to the store and list:
PHP Code:
Ext.regModel('Book',{
fields:[
{name:'bookname',type:'string'},
{name:'pages',type:'int'},
{name:'score',type:'int'}
]
})
Ext.regModel('User',{
fields:[
{name:'userid',type: 'int'},
{name:'username',type:'string'}
],
associations:[
{type:'hasMany',model:'Book',name:'books'}
]
});
var HitrateStore = new Ext.data.Store({
model: 'User',
proxy: {
type: 'ajax',
url: './src/combi.xml',
reader: {
type: 'xml',
record:'user'
}
},
listeners: {
load: function(store, records, success){
if(success)
{
if(debugMode)console.log('successfull loaded xml from server',records);
console.log(HitrateStore)
}
}
}
});
var testtpl = '<div class="graph">{username}</div>';
var list = new Ext.List({
cls:'lijst',
itemTpl:'<tpl for=".">'+ testtpl +'</tpl>',
itemSelector: 'div.graph',
singleSelect: false,
grouped : false,
indexBar : false,
layout: 'card',
store: HitrateStore,
floating : true,
width : 350,
height : 370,
centered : true,
modal : true,
hideOnMaskTap: false,
listeners: {
beforeactivate: function(c)
{
HitrateStore.load();
}
}
});
I dont get an error message. The users get loaded but their books dont get loaded....
Dont know where the problem is....
I also have updated to Sencha Touch 0.99....
Someone had the same problem or got an awnser?
Kind regards,