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

Showing no status message via fb query

$
0
0

WHat's wrong with below code ? pic and name are no problem but why status can't get ?

var tableView = Ti.UI.createTableView({top:60,minRowHeight:100});
    win.add(tableView);
    runQuery();
    function runQuery()
    {   
        b1.title = 'Loading...';
        // run query, populate table view and open window
        var query = "SELECT uid, name, pic_square, status FROM user ";
        query +=  "where uid IN (SELECT uid2 FROM friend WHERE uid1 = " + fb.uid + ")";
        query += "order by last_name";
        Ti.API.info('user id ' + fb.uid);
        fb.request('fql.query', {query: query},  function(r)
        {
            if (!r.success) {
                if (r.error) {
                    alert(r.error);
                } else {
                    alert("call was unsuccessful");
                }
                return;
            }
            var result = JSON.parse(r.result);
 
            Ti.API.info(result);
 
            var data = [];
            for (var c=0;c<result.length;c++)
            {
                var row = result[c];
 
                var tvRow = Ti.UI.createTableViewRow({
                    height:'auto',
                    selectedBackgroundColor:'#fff',
                    backgroundColor:'#fff'
                });
                var imageView;
                imageView = Ti.UI.createImageView({
                    image:row.pic_square === null ? '../images/custom_tableview/user.png' : row.pic_square,
                    left:10,
                    width:50,
                    height:50
                });
 
                tvRow.add(imageView);
 
                var userLabel = Ti.UI.createLabel({
                    font:{fontSize:16, fontWeight:'bold'},
                    left:70,
                    top:5,
                    right:5,
                    height:20,
                    color:'#576996',
                    text:row.name
                });
                tvRow.add(userLabel);
 
                var statusLabel = Ti.UI.createLabel({
                    font:{fontSize:13},
                    left:70,
                    top:25,
                    right:20,
                    height:'auto',
                    color:'#222',
                    text:(!row.status || !row.status.message ? 'No status message' : row.status.message)
                    //text: row.status
                });
                tvRow.add(statusLabel);
 
                tvRow.uid = row.uid;
 
                data[c] = tvRow;
            }
 
            tableView.setData(data, { animationStyle : Titanium.UI.iPhone.RowAnimationStyle.DOWN });
            b1.title = 'Run Query';
        });
    }

Viewing all articles
Browse latest Browse all 8068

Trending Articles



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