PDA

View Full Version : XML Store and List Component - very basic usage not working



big momo
18 Apr 2011, 11:28 AM
I'm trying to use very basic Model/Store/List setup to show some dates and text from XML. Nothing shows, and no errors are reported. The file loads properly (using an Ext.Ajax.request alerts out the content of the file).

XML (abbreviated) :


<?xml version="1.0" encoding="UTF-8" ?>
<events>
<event>
<title><![CDATA[Some "Quoted" Text]]></title>
<startdate>2011-4-19</startdate>
<starttime>9</starttime>
<enddate>2011-4-19</enddate>
<endtime>12</endtime>
</event>
<event>
<title><![CDATA[Another Event]]></title>
<startdate>2011-4-20</startdate>
<starttime>9</starttime>
<enddate>2011-4-20</enddate>
<endtime>12</endtime>
</event>
</events>

Model:

Ext.regModel('eventModel', {
fields: ['title', 'startdate', 'starttime', 'enddate', 'endtime']
});

Store:

var eventStore = new Ext.data.Store({
model: 'eventModel',
sorters : 'startdate',
getGroupString : function(record) {
return record.get('startdate'); // this is simplified for debug
},
proxy: {
type: 'ajax',
url : '../services/mobile/event-feed.xml',
reader: {
type: 'xml',
record: 'event',
root : 'events'
}
}
});

List:

var eventCard = new Ext.List({
grouped : true,
fullscreen : true,
store : eventStore,
itemTpl : '{startdate} - {enddate}' // also simplified for debug
});

This setup seems almost exactly like the samples shown, and yet fails.

I don't see any reason the XML wouldn't work, but I'll mention that I cannot modify it - it's generated by and for another application.

Any insight?

TYIA