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