PDA

View Full Version : RSS XML FEED ERROR!



pmarshallandrew
11 Aug 2011, 1:53 AM
So far i have managed to create a nested list , populated with a TreeStore from an xml RSS feed using the following Schema (help taken from the following link http://superdit.com/2010/12/18/building-rss-reader-with-sencha-touch-and-php/):

<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="2.0">
<channel>
<title>Vacancy Details</title>
<link>~/CAC/Home.aspx</link>
<description>Vacancy details for RSS</description>
<pubDate>28/07/2011 09:24:00</pubDate>
<item>
<title>Job1</title>
<link>https://blahblahblah.net/CAC/VacancyDetails.aspx?VacancyID=1757</link>
<pubdate>25/07/2011 08:56:41</pubdate>
<comments>CRT</comments>
<description>
To develop, implement, support and maintain, bespoke and packaged, application software too meet the organisationís business needs. TBC
</description>
<location>Multiple</location>
<internet>True</internet>
<intranet>True</intranet>
</item>
<item>
<title>Job2</title>
<link>blahblahblah.net/CAC/VacancyDetails.aspx?VacancyID=1770</link>
<pubdate>22/07/2011 20:31:07</pubdate>
<comments>CRT</comments>
<description>
To provide commercial leadership for the business channel being responsible for managing the commercial, business intelligence and the pricing process to ensure the business channel meets its financial and commercial targets.
</description>
<location> </location>
<internet>True</internet>
<intranet>True</intranet>
</item>
<item>....

I would like the detailCard to be loaded after u tap each item, but as there is no leaf attribute/node in the xml schema obviously the 'leafitemtap' is never fired /reached. I have also tried manually adding a <leaf>true</leaf> element to each of the item nodes and still getting no where. Could anyone on help on this matter as there are hardly any xml rss feed examples. Any help would be greatly appreciated :)

pmarshallandrew
11 Aug 2011, 2:11 AM
The following code base was used in the above example, apologies for not providing this earlier :) :

Ext.setup({
onReady: function () {

var model = Ext.regModel('ListItem', {
fields: [
{ name: 'title', type: 'string' },
{ name: 'description', type: 'string' },
{ name: 'link', type: 'string' },
{ name: 'pubdate', type: 'auto' }
]
});

var store = new Ext.data.TreeStore({
model: 'ListItem',
proxy: {
type: 'ajax',
url: 'http://localhost/test/testDataModified.xml',
reader: {
type: 'xml',
root: 'channel',
record: 'item'
}
},
autoLoad: true
});

var topToolbar = new Ext.Toolbar({
dock: 'top',
ui: 'dark',
title: 'Vacancies'

});

var nestedList = new Ext.NestedList({
getItemTextTpl: function (recordnode) {
var template = '<div class="{title}-icon"><ul><li>{title}</li><li class="subInfo">{pubdate}</li></ul></div>';

return template;
},
fullscreen: true,
style: 'font-weight:bold',
dockedItems: [topToolbar],
modal: true,
displayField: 'title',
store: store,
toolbar: {
dock: 'bottom',
id: 'tb1',
layout: {
pack: 'center'
},
items: [{
text: 'Home',
handler: function () {
store.setProxy({
type: 'ajax',
url: 'http://localhost/test/testDataModified.xml',
reader: {
//method: 'GET',
type: 'xml',
root: 'channel'
}
});
store.load();
topToolbar.setTitle("Vacancies");
}
}]
}

});
//This never gets hit :( , even after adding a leaf = true attribute/node to the xml
nestedList.on('leafitemtap', function (subList, subIdx, el, e, detailCard) {

alert('This never gets Hit');
var ds = subList.getStore(),
r = ds.getAt(subIdx);

/* store.setProxy({
type: 'ajax',
url: 'getFeed.php?blogid=' + subIdx,
reader: {
type: 'tree',
root: 'items'
}
});
store.load();*/
topToolbar.setTitle(r.get('description'));

nestedList.on('leafitemtap', function (subList, subIdx, el, e, detailCard) {
alert('test2');
var ds = subList.getStore(),
r = ds.getAt(subIdx);

window.location = r.get('url');
});

});

}
});

pmarshallandrew
16 Aug 2011, 1:39 AM
Can anyone assist with this please , as it has been a while :)