Am I handling the response object correctly? Does this work in the
Orkut sandbox?
In my gadget I have a required UserPref whose value is used when
rendering the profile view. My issue is that when I view a friends
profile, _my_ preference is used instead
of
When browsing as a VISITOR, I need the
OWNERs pref so that I can render the data from the right point of
view.
The pref is not set via the API it is set via the "edit settings"
feature in
Orkut.
When I try to fetch the userpref data, there are no keys in that sub-
response
object, just the top level key in main response.
Sample code:
My user pref is called tweb_uid.
<UserPref name='tweb_uid' display_name='Your Id' datatype='string'
required='true' />
Here is my javascript for accessing it:
<script>
function getOwnerData() {
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest("OWNER"), "owner");
req.add(req.newFetchPersonAppDataRequest("OWNER", "tweb_uid"),
"owner_data");
req.send(handleResponse);
}
function handleResponse(data) {
var owner = data.get("owner").getData();
var owner_data = data.get("owner_data")
if (owner_data.hadError()) {
//Handle error using owner_data.getError()...
alert( "Error: " + owner_data.getError);
return;
}
var owner_data1 = owner_data.getData()[owner.getId()];
alert( "ID: " + owner_data1["tweb_uid"] );
}
document.body.onload = getOwnerData();
</script>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"OpenSocial Developers" 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
-~----------~----~----~----~------~----~------~--~---