Hi,
I have some trouble with my simple gadget.
Here is the code of my .xml file and the code of the .js file which
belongs to it:
XML-File:
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="API test app" author_email="">
<Require feature="opensocial-0.7"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
<script src="http://mitglied.lycos.de/xxx/API.js"></script>
<script>gadgets.util.registerOnLoadHandler(init);</script>
<b>ownerFriends:</b>
<div id='ownerFriendsList'><div>
<b>viewerFriends:</b>
<div id='viewerFriendsList'></div>
]]>
</Content>
</Module>
JS-File:
function requestData()
{
//to create a new DataRequest Object
var req = opensocial.newDataRequest();
//add individual request to the DataRequest Object
req.add(req.newFetchPersonRequest('OWNER'), 'owner');
req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER),
'viewer');
req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.VIEWER_FRIENDS),
'viewerFriends');
req.add(req.newFetchPeopleRequest('OWNER_FRIENDS'), 'ownerFriends');
//distribute the request "send(optional-callbackfunction)"
req.send(onLoadFriends);
}
function onLoadFriends(data)
{
var owner = data.get('owner').getData();
var viewer = data.get('viewer').getData();
var varOwnerFriends = data.get('ownerFriends').getData();
var varViewerFriends = data.get('viewerFriends').getData();
var html = new Array();
html.push('<ul>');
varOwnerFriends.each(function(listOfOwnerFriends){
html.push('<li>'+listOfOwnerFriends.getDisplayName()+'</li>');
});
html.push('</ul>');
document.getElementById('ownerFriendsList').innerHTML =
html.join('');
var htmlFriends = new Array();
htmlFriends.push('<ul>');
varViewerFriends.each(function(listOfViewerFriends){
htmlFriends.push('<li>'+listOfViewerFriends.getDisplayName()+'</
li>');
});
htmlFriends.push('</ul>');
document.getElementById('viewerFriendsList').innerHTML =
htmlFriends.join('');
}
function init()
{
requestData();
}
Everytime I load this gadget, it shows me the "ownerFriends: with the
list of the owners friends" but after this it stops and Firebug
reports me an error:"document.getElementById("viewerFriendsList") has
no properties". I have tried my app under orkut and hi5 and both got
the same error.
Funny is:
On orkut sometimes the error changed into the follwing:
"varViewerFriends.each(function(listOfViewerFriends){ ,
varViewerFriends has no properties"
after some refresh or delete and submit the gadget again (without any
changes to the code) the error isn't anymore. Maybe this will also be
happen on hi5 but till now I didn't get this 2nd error on hi5.
Like you can see I host my .xml and .js file on lycos, I allready
thought about connection problems and uploaded my files to google.code
but with no result.
I don't get it, the line with
"document.getElement.ById("viewerFriendsList")" is just nearly the
same like I use it for the ownersFriendsList , some line before ...
Could someone help me or got such a error too ??
best regards
heiko
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---