ida.nn
19 Oct 2010, 6:31 AM
I want to make a simple clickable list which get data from an XML file, but I dont know why it doesn't work...I haven't done anything with Sencha before.
I get an error like: "Uncaught TypeError: Cannot call method 'indexOf' of undefined" from debug sencha library????
Could you please help me to find out what's wrong with it?
Here is the code:
// JavaScript Document
Ext.onReady(function(){
//Get data from xml**********************************
var store = new Ext.data.XmlStore({
// store configs
autoLoad : true,
storeId: 'myStore',
url: 'feed.xml', // automatically configures a HttpProxy
record: 'Item',
idPath: 'id',
fields: [
{
name: 'id',
mapping: 'id'
},
{
name: 'title',
mapping: 'title'
}
]
});
//SHow in Listview******************************
var list = new Ext.List({
floating: true,
singleSelect: true,
store: list, //cteo to store
centered: true,
//Listinerrrrrrr
listeners: {
"itemtap": function(list, index, item, e) {
alert('itemtap');
}
}
});
list.show;
//Show in a panel*******************************
var panel = new Ext.Panel({
fullscreen: true,
layout:'fit',
title:'Simple ListView (0 items selected)',
items: list
});
//panel.render(document.body);
});
And here is the XML file:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<item>
<id>1</id>
<title>Ajax and XUL</title>
</item>
<item>
<id>2</id>
<title>News of today</title>
</item>
</channel>
</rss>
I get an error like: "Uncaught TypeError: Cannot call method 'indexOf' of undefined" from debug sencha library????
Could you please help me to find out what's wrong with it?
Here is the code:
// JavaScript Document
Ext.onReady(function(){
//Get data from xml**********************************
var store = new Ext.data.XmlStore({
// store configs
autoLoad : true,
storeId: 'myStore',
url: 'feed.xml', // automatically configures a HttpProxy
record: 'Item',
idPath: 'id',
fields: [
{
name: 'id',
mapping: 'id'
},
{
name: 'title',
mapping: 'title'
}
]
});
//SHow in Listview******************************
var list = new Ext.List({
floating: true,
singleSelect: true,
store: list, //cteo to store
centered: true,
//Listinerrrrrrr
listeners: {
"itemtap": function(list, index, item, e) {
alert('itemtap');
}
}
});
list.show;
//Show in a panel*******************************
var panel = new Ext.Panel({
fullscreen: true,
layout:'fit',
title:'Simple ListView (0 items selected)',
items: list
});
//panel.render(document.body);
});
And here is the XML file:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<item>
<id>1</id>
<title>Ajax and XUL</title>
</item>
<item>
<id>2</id>
<title>News of today</title>
</item>
</channel>
</rss>