16 messages in com.googlegroups.opensocial-apiRe: Hahaha!! Is this method right??????| From | Sent On | Attachments |
|---|---|---|
| 1....@smallsocialworld.com | 18 Mar 2008 02:35 | |
| Arne Roomann-Kurrik (Google) | 18 Mar 2008 10:41 | |
| youn...@126.com | 18 Mar 2008 22:12 | |
| Arne Roomann-Kurrik | 18 Mar 2008 22:27 | |
| youn...@126.com | 18 Mar 2008 23:59 | |
| youn...@126.com | 19 Mar 2008 00:09 | |
| Franxis Magpantay | 19 Mar 2008 01:55 | |
| Arne Roomann-Kurrik | 19 Mar 2008 09:48 | |
| 1....@smallsocialworld.com | 20 Mar 2008 01:24 | |
| 1....@smallsocialworld.com | 20 Mar 2008 01:31 | |
| Arne Roomann-Kurrik (Google) | 20 Mar 2008 08:48 | |
| 1....@smallsocialworld.com | 21 Mar 2008 01:45 | |
| 1....@smallsocialworld.com | 21 Mar 2008 01:47 | |
| Arne Roomann-Kurrik | 21 Mar 2008 10:23 | |
| 1....@smallsocialworld.com | 21 Mar 2008 18:05 | |
| 1....@smallsocialworld.com | 21 Mar 2008 18:43 |
| Subject: | Re: Hahaha!! Is this method right??????![]() |
|---|---|
| From: | 1....@smallsocialworld.com (1....@smallsocialworld.com) |
| Date: | 03/21/2008 01:45:45 AM |
| List: | com.googlegroups.opensocial-api |
I am sorry it is a wrong answer. I have run your answer many times,it can not reach the right result. If you can not solve the problem,please let some other persons to solve the problem , OK!! ChePi.
On Mar 20, 11:49 pm, "Arne Roomann-Kurrik (Google)" <api....@google.com> wrote:
Please see my first response in this thread for the problem with the code that you're posting.
~Arne
On Mar 20, 1:31 am, 1....@smallsocialworld.com wrote:
I very sorry there is something wrong with these codes please change these words "html += '<li>' + sex.getKey() + '</li>'; " to "html += '<li>' + sex + '</li>'; "
That is all, thanks!
On Mar 20, 4:24 pm, 1....@smallsocialworld.com wrote:
Now I will give you my modified codes , When I test these codes have got nothing I past these here ,I think it will help you easiely to point out the errors.
<script type="text/javascript"> function getData() { var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER),'viewer'); req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.OWNER_FRIENDS),'viewerFriends'); req.send(onLoadFriends);
};
function onLoadFriends(dataResponse) { var viewer = dataResponse.get('viewer').getData(); var html = 'Friends of ' + viewer.getDisplayName(); html += ':<br><ul>'; var viewerFriends = dataResponse.get('viewerFriends').getData(); viewerFriends.each(function(person) { var sex = person.getField(opensocial.Person.Field.GENDER).getKey();
html += '<li>' + sex.getKey() + '</li>';
});
html += '</ul>'; document.getElementById('message').innerHTML = html;
};
gadgets.util.registerOnLoadHandler(getData); </script> <div id="message"> </div>
Can get the user's friends' gender??? Please reply me as soon as possible. I have do these codes for a too long time and my boss have got a little anger. Thanks very much!
On Mar 19, 4:55 pm, "Franxis Magpantay" <neox...@gmail.com> wrote:
On Wed, Mar 19, 2008 at 1:12 PM, <youn...@126.com> wrote:
I have tried these codes already, but I have not got the right result!!
On Mar 19, 1:41 am, "Arne Roomann-Kurrik (Google)" <api....@google.com> wrote:
Hello,
Gender is only returned for users who have your application installed. You should check that the object returned isn't null. Change:
var sex = person.getField(opensocial.Person.Field.GENDER).getKey(); html += '<li>' + sex + '</li>';
To:
var sex = person.getField(opensocial.Person.Field.GENDER); if (sex && sex.getKey) { html += '<li>' + sex.getKey() + '</li>'; }
~Arne
On Mar 18, 2:36 am, 1....@smallsocialworld.com wrote:
function getData() { var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest( opensocial.DataRequest.PersonId.OWNER), 'viewer'); req.add(req.newFetchPeopleRequest( opensocial.DataRequest.Group.OWNER_FRIENDS), 'viewerFriends'); req.send(onLoadFriends);
};
function onLoadFriends(dataResponse) { var viewer = dataResponse.get('viewer').getData(); var html = 'Friends of ' + viewer.getDisplayName(); html += ':<br><ul>'; var viewerFriends = dataResponse.get('viewerFriends').getData(); viewerFriends.each(function(person) { var sex = person.getField(opensocial.Person.Field.GENDER).getKey();
html += '<li>' + sex + '</li>';
});
html += '</ul>'; document.getElementById('message').innerHTML = html;};
<div id="message"> </div>
In these codes is the method var sex = person.getField(opensocial.Person.Field.GENDER).getKey(); right??? If this method is right , why can not I output the sex of the person????
-- It must suck to be human. If I was born a human (or as you), I would have killed myself.




