Wondering if anybody might be able to show me where I'm screwing up
here. Everything I get back using getField() is either null or
undefined. The only thing that seems to work is getDisplayName().
gadgets.util.registerOnLoadHandler(init);
function loadFriends() {
var req = opensocial.newDataRequest();
var params = {};
params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS]=
[opensocial.Person.Field.ID,
opensocial.Person.Field.NAME,
opensocial.Person.Field.GENDER,
opensocial.Person.Field.REGION];
req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER),
'owner');
req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.OWNER_FRIENDS,
params), 'ownerFriends');
req.send(onLoadFriends);
}
function onLoadFriends(data) {
var owner = data.get('owner').getData();
var ownerFriends = data.get('ownerFriends').getData();
var content = document.getElementById('content');
var username = document.createElement('div');
var userbody = document.createElement('div');
var userleft = document.createElement('div');
var userright = document.createElement('div');
var name = owner.getField( opensocial.Person.Field.NAME );
alert(name);
username.setAttribute("class", "username");
username.setAttribute("className", "username");
userbody.setAttribute("class", "userbody");
userbody.setAttribute("className", "userbody");
userleft.setAttribute("class", "userleft");
userleft.setAttribute("className", "userleft");
userright.setAttribute("class", "userright");
userright.setAttribute("className", "userright");
username.innerHTML = owner.getDisplayName() + "<hr>";
userleft.innerHTML = "<b>Name:<br>Location:<br>Email:<br><br>General
Info:<br></b>";
userright.innerHTML = owner.getField(opensocial.Person.Field.NAME) +
"<br>";
alert(owner.getField(opensocial.Person.Field.ID));
alert("Name: " + owner.getField(opensocial.Person.Field.NAME));
alert(owner.getField(opensocial.Person.Field.ABOUT_ME));
userbody.appendChild(userleft);
userbody.appendChild(userright);
content.appendChild(username);
content.appendChild(userbody);
}
function init() {
loadFriends();
}
Fairly bumfuzzled,
-Zach
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"OpenSocial Application Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/opensocial-api?hl=en
-~----------~----~----~----~------~----~------~--~---