Manu_Fr
24 Jul 2011, 5:27 AM
Hello !
I'm a french student learning Sencha Touch. Since a few days now, I have been trying an example of displaying an xml data using a list or a nestedlist... It should be something very simple but it doesn't work at all.
I read a lot of threads about how to load XML data but I still don't find the solution for me...
Firstly I copied a simple xml tree from the Sencha Touch documentation :
<?xml version="1.0" encoding="UTF-8"?>
<users>
<user>
<id>1</id>
<name>Ed Spencer</name>
<email>ed@sencha.com</email>
</user>
<user>
<id>2</id>
<name>Abe Elias</name>
<email>abe@sencha.com</email>
</user>
</users>
and this is my javascript file :
Ext.setup({
onReady: function() {
Ext.regModel('User', {
fields: ['id', 'name', 'email']
});
var store = new Ext.data.Store({
model: 'User',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'users.xml',
reader: {
type: 'xml',
root: 'users',
record: 'user'
}
}
});
var list = new Ext.List({
floating: true,
singleSelect: true,
store: store,
centered: true,
emptyText: 'No XML'
});
list.show();
}
});
If anyone have suggestions...
greetings to all.
I'm a french student learning Sencha Touch. Since a few days now, I have been trying an example of displaying an xml data using a list or a nestedlist... It should be something very simple but it doesn't work at all.
I read a lot of threads about how to load XML data but I still don't find the solution for me...
Firstly I copied a simple xml tree from the Sencha Touch documentation :
<?xml version="1.0" encoding="UTF-8"?>
<users>
<user>
<id>1</id>
<name>Ed Spencer</name>
<email>ed@sencha.com</email>
</user>
<user>
<id>2</id>
<name>Abe Elias</name>
<email>abe@sencha.com</email>
</user>
</users>
and this is my javascript file :
Ext.setup({
onReady: function() {
Ext.regModel('User', {
fields: ['id', 'name', 'email']
});
var store = new Ext.data.Store({
model: 'User',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'users.xml',
reader: {
type: 'xml',
root: 'users',
record: 'user'
}
}
});
var list = new Ext.List({
floating: true,
singleSelect: true,
store: store,
centered: true,
emptyText: 'No XML'
});
list.show();
}
});
If anyone have suggestions...
greetings to all.