I have got the list of my friends and i can traverse through the collection to list them as per my requirement. But I want to show them in different pages as the people on myspace may have more than 100s of friends, so I dont want to show them on the same page. What would be the best way to show them in pages.
Currently i m doing the following:
<script type="text/javascript">
function init()
{
//creating request to get the friends
var request = opensocial.newDataRequest();
var params0 = {};
params0[opensocial.IdSpec.Field.USER_ID] = opensocial.IdSpec.PersonId.OWNER;
params0[opensocial.IdSpec.Field.NETWORK_DISTANCE] = 1;
var idspec = opensocial.newIdSpec(params0);
request.add(request.newFetchPeopleRequest(idspec), "friends");
request.add(request.newFetchPersonRequest("OWNER"), "get_owner");
request.send(got_myfriends);
}
function got_myfriends(response0)
{
//document.getElementById('message').innerHTML += "TESTING" + response0.data;
var friends=response0.get("friends").getData().asArray();
//document.getElementById('message').innerHTML += " TESTING0";
var owner = response0.get('get_owner').getData();
document.getElementById('message').innerHTML += " TESTING1--ownerid: " + owner.getId();
document.getElementById('message').innerHTML +=" Total friends found: " + friends.length;
var id, image, name;
for(var i = 0; i < friends.length; i++){
id = friends[i].getId();
image = friends[i].getField(opensocial.Person.Field.THUMBNAIL_URL);
name = friends[i].getDisplayName();
document.getElementById('friendsdiv').innerHTML += "<div style='display:inline;float:left;width:150px;'><input type='radio' name='friendid' value='" + id + "'>" + name +"<BR><img src='" + image + "'></div>";
}
}
</script>