Hi all. How do I grab feeds from my own XML?
This are some parts of my code:
CODE
var MainView = new KONtx.Class({
ClassName: 'MainView',
Extends: KONtx.system.SidebarView,
config: {
RSSFeed: 'file:///devwidgets/siaokina.test.com.tv.widget/Contents/Javascript/views/Movies.xml',
RSSFeed_XML: false, //A simple holder for our XMl Feed that also acts a Network success indicator
RSSFeed_items: [] //Setup a Quick Array to hold our RSS Feed Items
},
createView: function() {
var self = this; //We need a variable to reference the main Class inside our button
//Create a button at the top of the so we can update the view by selecting the button
this.controls['button'] = new KONtx.control.TextButton({
label: 'Update RSS Feed',
styles: $content.styles.main.button,
events:{
//Setup a onSelect Event to handle the button action
onSelect:function(event){
self.grabRSS(self.config.RSSFeed);
}
}
}).appendTo(this);
grabRSS: function(url){
KONtx.utility.LoadingOverlay.on();
var self = this;
KONtx.utility.LoadingOverlay.off();
//I have no idea how to grab feeds from my own XML from here onwards
},
This should get you started:
CODE
var MainView = new KONtx.Class({
ClassName: 'MainView',
Extends: KONtx.system.SidebarView,
config: {
RSSFeed: 'Javascript/views/Movies.xml',
RSSFeed_XML: false, //A simple holder for our XMl Feed that also acts a Network success indicator
RSSFeed_items: [] //Setup a Quick Array to hold our RSS Feed Items
},
createView: function() {
///var self = this; NOTE you don't need this, see below how you can reference the view from within a control's event listener;
//Create a button at the top of the so we can update the view by selecting the button
this.controls['button'] = new KONtx.control.TextButton({
label: 'Update RSS Feed',
styles: $content.styles.main.button,
events:{
//Setup a onSelect Event to handle the button action
onSelect:function(event){
this.getView().grabRSS(this.getView().config.RSSFeed);
}
}
}).appendTo(this);
},
//NOTE grabRSS shouldn't be in createView so I moved it out;
grabRSS: function(url){
KONtx.utility.LoadingOverlay.on();
var xml = XMLDOM.parse(filesystem.readFile(url); //NOTE this creates an XML DOM document;
KONtx.utility.LoadingOverlay.off();
//I have no idea how to grab feeds from my own XML from here onwards
},
Please refer to the online docs
here.