You could do this the other way round:

On the gadget side you could register yourself to the onload event
(gadgets.util.registerOnLoadHandler) and send an rpc call to the container.

gadgets.rpc.call('..', 'put_data_set', function(dataSets) {

opensocial.data.DataContext.
putDataSets(dataSets);


}, null);


The container side can create the data set object and pass it to the gadget
via the specified callback, which in turn sets the new dataset on the gadget
side:

gadgets.rpc.register('put_
data_set', function() {
  this.callback(object);
});


2011/2/15 Ryan J Baxter <[email protected]>

> Is there any way to know when a gadget is rendered in the container so I
> can make an RPC call to the gadget from the container?  The function
> callSameDomain is throwing an error, Same domain call failed: parent=
> incorrectly set., because targetEl.gadgets is undefined.  targetEl is the
> target window the RPC call is going to.  I am assuming targetEl.gadgets is
> undefined because the iFrame with the gadget has not completely rendered
> yet.  If I hold off on making the RCP call everything works fine.
>
> -Ryan
>
> Email: [email protected]
> Phone: 978-899-3041
> developerWorks Profile
>
>
>
> From:   Bastian Hofmann <[email protected]>
> To:     [email protected],
> Date:   02/14/2011 03:27 AM
> Subject:        Re: Manipulating Data Context From A Container
>
>
>
> No,
>
> if you add something like the following on the gadget side:
>
> gadgets.rpc.register('put_data_set', function(dataSets) {
>  opensocial.data.DataContext.putDataSets(dataSets);
> });
>
> you can call the rpc method put_data_set from your container:
>
> gadgets.rpc.call('gadget_iframe_id', 'put_data_set', null, {key: value});
>
> And the registered method will be called on the gadget side automatically.
>
> Hope this helps
>
> Bastian
>
> 2011/2/11 Ryan J Baxter <[email protected]>
>
> > Brian wouldn't this still require the gadget to call putDataSet?  I
> don't
> > want the gadget to have to do anything, instead I would like to put
> > something in the data context for a gadget from the container.  That way
> > the gadget can just use it.
> >
> > -Ryan
> >
> > Email: [email protected]
> > Phone: 978-899-3041
> > developerWorks Profile
> >
> >
> >
> > From:   Bastian Hofmann <[email protected]>
> > To:     [email protected],
> > Date:   02/10/2011 05:01 PM
> > Subject:        Re: Manipulating Data Context From A Container
> >
> >
> >
> > You probably will have to register the
> > opensocial.data.DataContext.putDataSet method as an rpc method on the
> > gadget
> > side and then use rpc to push the data from the container (similar to
> the
> > current implementation of a security token update (auth-refresh)).
> >
> > Cheers
> >
> > Bastian
> >
> > 2011/2/10 Ryan J Baxter <[email protected]>
> >
> > > I would like to be able to set something in a gadgets data context
> > object
> > > from the container.  The feature only provides the javascript API to
> the
> > > gadget, which makes sense.  It looks as though things are inserted
> into
> > > the data context object by injecting the javascript to do so when the
> > > gadget is rendered.  Looks like PipelineDataGadgetRewriter.java does
> > this.
> > >  Does anyone know is its possible to manipulate a gadget's data
> context
> > > object from the container?  At the moment it does not look like it is.
> > >
> > > -Ryan
> > >
> > > Email: [email protected]
> > > Phone: 978-899-3041
> > > developerWorks Profile
> > >
> > >
> >
> >
> >
> >
>
>
>
>

Reply via email to