Do you have a representative URL?

Your value should be a serialized JSON blob:
http://svn.apache.org/repos/asf/shindig/trunk/features/src/main/javascript/features/views/views.js

    var urlParams = gadgets.util.getUrlParameters();
    // View parameters are passed as a single parameter.
    if (urlParams["view-params"]) {
      params = gadgets.json.parse(urlParams["view-params"]) || params;
    }



On Fri, May 21, 2010 at 5:09 PM, Jason Eggers <
jason.egg...@infinitecampus.com> wrote:

> Thanks Chirag,
>
> I've tried this as well and put that back in there. It adds the parameter
> to the url but I'm unable to pull view-params in the gadget by either using:
> gadgets.util.getUrlParameters() (contains container, mid, nocache, country,
> lang, view, parent, st, url, and rpctoken)
> or
> gadgets.views.getParams() (completely empty)
>
> Is there another way to pull those params through?
>
> Thanks!
> Jason
>
> ________________________________________
> From: Chirag Shah [chiragsh...@gmail.com]
> Sent: Friday, May 21, 2010 5:23 PM
> To: dev@shindig.apache.org
> Subject: Re: Passing params to a view
>
> This isn't documented very well, but try adding the following to the
> url. The representation of view-param is json.
>
> url += '&view-params=' + encodeURIComponent(paramStr);
>
> Thanks,
> Chirag
>
> On Fri, May 21, 2010 at 11:38 AM, Jason Eggers
> <jason.egg...@infinitecampus.com> wrote:
> > Does anyone know how to do the following? I've got a custom gadget that I
> want to link to itself while passing an ID to view more details on that
> item. This gadget is using the views feature. Currently on the home/default
> view (http://localhost:8000/dashboard) there is a link that makes a call
> to requestNavigateTo:
> >
> > gadgets.views.requestNavigateTo('canvas',{'id':'1234'})
> >
> > This redirects the page to
> http://localhost:8000/dashboard?view=canvas&gadget=9&appParams={}<
> http://localhost:8000/dashboard?view=canvas&gadget=9&appParams=%7b%7d>
> which is mostly correct except for no params seem to be passed to the
> gadget. I've had to override the getUrlForView to get the url to form
> correctly:
> > gadgets.IfrGadgetService.prototype.getUrlForView = function(
> >    view) {
> >  return '/dashboard?view='+view;
> > }
> >
> > Along with modifying requestNavigateTo to pass the gadget param:
> >
> > gadgets.IfrGadgetService.prototype.requestNavigateTo = function(view,
> >    opt_params) {
> >  var id =
> gadgets.container.gadgetService.getGadgetIdFromModuleId(this.f);
> >  var url = gadgets.container.gadgetService.getUrlForView(view);
> >  url += '&gadget='+id;  //customization
> >
> >  if (opt_params) {
> >    var paramStr = gadgets.json.stringify(opt_params);
> >    if (paramStr.length > 0) {
> >     url += '&appParams=' + encodeURIComponent(paramStr);
> >    }
> >  }
> >
> >  if (url && document.location.href.indexOf(url) == -1) {
> >    document.location.href = url;
> >  }
> > };
> >
> > I'm trying to pull the params a number of ways including:
> > gadgets.views.getParams()
> > gadgets.util.getUrlParameters()
> >
> > My question is how do I go about passing a view parameter through to the
> gadget?
> >
> > We're currently using Shindig 1.1 Beta 5.
> >
> > Many thanks,
> > Jason
> >
>

Reply via email to