Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

How can I pass the custom tag to xml

$
0
0

I am making RSS reader on alloy

I would like to give title and link for each row and use them when it is clicked.

Please check my index.js.

I wonder how can I pick up the attributes of each row in addEventlistener?

index.js

var xhr = Ti.Network.createHTTPClient();
url = 'http://testtettest.info/feed.xml;
 
xhr.open('GET', url);
 
xhr.onload = function() {
    Ti.API.info('onload()');
    try{
        var doc = this.responseXML.documentElement;
        var items = doc.getElementsByTagName('item');
        for (var i = 0; i < items.length;i++){
            var title = items.item(i).getElementsByTagName('title').item(0).text;
            var link = items.item(i).getElementsByTagName('link').item(0).text;
            bgcolor = true;
            var row = Alloy.createController("row",{
                id: i+1,
                title: title,
                link: link,
                bgcolor: bgcolor
            }).getView();
                $.tableByFav.appendRow(row);?
        }   
    }catch(e){alert(e);}
}
try{
    xhr.send();
}catch( e ) {alert(e);
}
 
$.tableByFav.addEventListener('click',function(e){
    Ti.API.info(e.row.children[0].text);//I can pick up the title;
    //but how can I pick up the link ?????
})
$.index.open();
row.js
var args = arguments[0] || {};
 
$.row.backgroundColor = args.bgcolor ? "#faf8f5" : "#eee4db";  
 
$.title.text = args.title;  
$.link = args.link;
row.xml
<Alloy>
??<TableViewRow id="row">
????<Label id="title">Menu</Label>
 
??</TableViewRow>
</Alloy>

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>