11 messages in com.googlegroups.opensocial-orkutRe: Error: data[viewer.getId()] has n...| Subject: | Re: Error: data[viewer.getId()] has no properties![]() |
|---|---|
| From: | rush (rock...@gmail.com) |
| Date: | 02/29/2008 01:48:53 AM |
| List: | com.googlegroups.opensocial-orkut |
Still not working :( I m using following code
gadgets.util.registerOnLoadHandler(init);
function init() { loadFriends(); }
function loadFriends() { var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest('OWNER'), 'viewer'); req.send(onLoadFriends); } var me=null; function onLoadFriends(data) { me = data.get('viewer').getData(); alert(me.getDisplayName()); var req1 = opensocial.newDataRequest(); var fields = [ "flag"];
req1.add(req1.newFetchPersonAppDataRequest(opensocial.DataRequest.PersonId.OWNER,fields),'data');
req1.send(onLoadAppData);
} function onLoadAppData(data) { var mydata = data.get('data').getData(); if(!hasFlag(mydata)) { alert("not flagged"); var req2 = opensocial.newDataRequest(); var data1 = "true"; req2.add(req2.newUpdatePersonAppDataRequest("VIEWER", "flag", data1)); req2.send(handlePopulateMyAppData);
} else { alert("flagged"); }
} function handlePopulateMyAppData(data) { alert("data updated"); };
function hasFlag(data) {
if(data==null) { return false; } var mydata = data[me.getId()]; if(mydata["flag"]=="true") return true; return false; };
showing error "mydata has no properties" :(
On Feb 29, 11:57 am, pradeep <mite...@gmail.com> wrote:
Use three different requests for app data update , (person-people requests) and app data fetch.
I am using this method and the problem got solved.
On Feb 29, 10:46 am, rush <rock...@gmail.com> wrote:
Hi Pradeep,
Thanks for reply. I have made changes as u said but still not working and same error. Actually I want data for viewer and it was working fine in the giving gifts example as well as in my application before two days. But when I tried it yesterday it was not working.
var opt_params = { }; opt_params[opensocial.DataRequest.PeopleRequestFields.FILTER]=[opensocial.DataRequest.FilterType.HAS_APP];
var req = opensocial.newDataRequest(); req.add(req.newUpdatePersonAppDataRequest(opensocial.DataRequest.PersonId.OWNER, 'gifts', json)); req.add(req.newFetchPersonRequest('OWNER'), 'viewer'); req.add(req.newFetchPeopleRequest('OWNER_FRIENDS'), 'viewerFriends'); req.add(req.newFetchPersonAppDataRequest(opensocial.DataRequest.PersonId.OWNER,'gifts'), 'data'); req.add(req.newFetchPersonAppDataRequest(opensocial.DataRequest.Group.OWNER_FRIENDS,'gifts',opt_params), 'viewerFriendData'); req.send(onLoadFriends);
Regards Rush
On Feb 29, 10:05 am, pradeep <mite...@gmail.com> wrote:
Hi Rush,
Change the request logic for getting app data as follows
var req = opensocial.newDataRequest(); var opt_params = { }; opt_params[opensocial.DataRequest.PeopleRequestFields.FILTER] =[opensocial.DataRequest.FilterType.HAS_APP]; req.add(req.newFetchPersonAppDataRequest(opensocial.DataRequest.PersonId.OWNER, 'gifts'), 'data'); req.add(req.newFetchPersonAppDataRequest(opensocial.DataRequest.Group.OWNER_FRIENDS, 'gifts',opt_params), 'viewerFriendData'); req.send(onLoadAppData);
Use OWNER_FRIENDS instead of VIEWER_FRIENDS.
On Feb 29, 9:48 am, rush <rock...@gmail.com> wrote:
Is there anybody who can help me? It is not working yet.
Thanks Rush
On Feb 28, 1:55 pm, rush <rock...@gmail.com> wrote:
Hi all,
I got the error while executing the sample code of giving gifts
available in tutorial.
Error: data[viewer.getId()] has no properties
Source
File:http://opensocial-resources.googlecode.com/svn/samples/tutorial/tags/api
-0.7/gifts_4_showing_received.js Line: 36
The same error is also in my application. What is the problem?
Thanks Rush- Hide quoted text -
- Show quoted text -- Hide quoted text -




