fixed, thanks jason for a solution :D
On Sep 2, 3:39 pm, Jason <[EMAIL PROTECTED]> wrote:
> Are you saying that your verification is failing in the case when
> there aren't any friends with the application installed? If so, try
> this verification code instead.
>
> if (!data || data.hadError() || data.get('viewer_friends').hadError())
> {
> // Error retrieving data
> return false;}
>
> var viewer_friends = data.get('viewer_friends').getData();
> if (viewer_friends.size() < 1) {
> // No friends with the app
> return false;
>
> }
>
> Notice that I'm using the opensocial.Collection size() method to
> return the number of objects in the collection. Just move this snippet
> to the top of your response function and you should be good to go. Let
> me know if I didn't answer your question or if this still doesn't
> work, and provide more details about what the problem is. Thanks.
>
> - Jason
>
> On Aug 30, 9:20 pm, Vinicius <[EMAIL PROTECTED]> wrote:
>
> > Hi this my code does not function, necessary to verify if using it
> > does not have the applicatory one, sees:
>
> > . . .
> > function getFriends() {
> > var req = opensocial.newDataRequest();
> > var opt_params = {};
> > opt_params[opensocial.DataRequest.PeopleRequestFields.MAX] = 1000;
> > opt_params[opensocial.DataRequest.PeopleRequestFields.FILTER] =
> > opensocial.DataRequest.FilterType.HAS_APP;
> > opt_params[opensocial.DataRequest.PeopleRequestFields.SORT_ORDER] =
> > opensocial.DataRequest.SortOrder.NAME;
>
> > opt_params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS]
> > =
> > [opensocial.Person.Field.PROFILE_URL];
>
> > req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER,
> > opt_params), "viewer");
>
> > req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.VIEWER_FRIENDS,
> > opt_params), "viewer_friends");
> > req.send(responseFriends);
>
> > }
>
> > function responseFriends(data) {
> > _gel('div_myfriends').innerHTML = '';
> > var viewer = data.get("viewer").getData();
> > var thumb =
> > viewer.getField(opensocial.Person.Field.THUMBNAIL_URL);
> > var profile =
> > viewer.getField(opensocial.Person.Field.PROFILE_URL);
> > var viewer_friends = data.get("viewer_friends").getData();
>
> > //this verification ,it does not work
> > if(viewer_friends == null || data == 'null' || data == undefined ||
> > viewer_friends == 'null'){
> > document.getElementById('div_myfriends').innerHTML = "its friends
> > do not have the applicatory one";
> > return false;
>
> > }
>
> > viewer_friends.each(function(person) {
> > var thumb =
> > person.getField(opensocial.Person.Field.THUMBNAIL_URL);
> > var profile =
> > person.getField(opensocial.Person.Field.PROFILE_URL);
> > _gel('div_myfriends').innerHTML += "<td><a href="+profile+"
> > target='_top'><img src="+thumb+" />"+person.getDisplayName();+"</a></
> > td>";
> > });
>
> > }
>
> > . . .
>
> > help me, please !!!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Orkut Developer Forum" group.
To post to this group, send email to opensocial-orkut@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/opensocial-orkut?hl=en
-~----------~----~----~----~------~----~------~--~---