Titanium: ListView load remote images -
i've got below bit of code pull list of users facebook contacts along profile picture, images not loading each user, showing images few users.
fb.requestwithgraphpath('me/friends', { fields : 'first_name,last_name,id,installed,picture.width(120).height(120),gender' }, 'get', function(e) { if (e.success) { var d = json.parse(e.result); var pdata = []; var idata = []; var row = d.data; row = row.sort(sortbyname) (var = 0; < d.data.length; i++) { var img = row[i].picture.data.url if (row[i].installed) { pdata.push({ properties : { title : row[i].first_name + " " + row[i].last_name, id : row[i].id, image : img, gender : row[i].gender, accessorytype : ti.ui.list_accessory_type_disclosure }, template : ti.ui.list_item_template_default }); } else { idata.push({ properties : { title : row[i].first_name + " " + row[i].last_name, id : row[i].id, image : img, accessorytype : ti.ui.list_accessory_type_disclosure }, template : ti.ui.list_item_template_default }); } } var play = ti.ui.createlistsection({ headertitle : 'play facebook friends', items : pdata }); var invite = ti.ui.createlistsection({ headertitle : 'invite facebook friends', items : idata }); var listview = ti.ui.createlistview({ sections : [play, invite], }); self.add(listview) } else { alert("facebook error"); } })
the images stored in var img = row[i].picture.data.url
, pushed data array part of image : img
not images loading.
is there way force images load? , show default image whilst loading?
here link complete example trying accomplish abaove
http://www.clearlyinnovative.com/blog/post/34758524584/alloy-listview-facebook-friends#.ugexzgratrg
Comments
Post a Comment