Got it. I missed something obvious and didn't pass the view-params in the dashboard setup to the gadgets.
var urlParams = gadgets.util.getUrlParameters() gadgetList[g].viewParams = urlParams['view-params']; Thanks for everyone's help! Jason ________________________________________ From: Jason Eggers [[email protected]] Sent: Friday, May 21, 2010 8:48 PM To: [email protected] Subject: RE: Passing params to a view It looks like the server isn't adding the view-params to the url. When I output document.location.href I get: http://localhost:8000/gadgets/ifr?container=default&mid=9&nocache=1&country=ALL&lang=ALL&view=canvas&parent=http%3A%2F%2Flocalhost%3A8000&st=john.doe:john.doe:appid:cont:url:0:default&url=http%3A%2F%2Flocalhost%3A8000%2Fgadgets%2Fcases.xml#rpctoken=1091508789 Any ideas on how to configure the server to include the view-params? ________________________________________ From: Jason Eggers [[email protected]] Sent: Friday, May 21, 2010 8:12 PM To: [email protected] Subject: RE: Passing params to a view John, This is the url: http://localhost:8000/dashboard?view=canvas&gadget=9&view-params={%22id%22%3A%221234%22} >From looking at views.js in the past I've tried the following to pull the id >as well: var p = gadgets.views.params; var i = 0; for (var i in p) { alert('p[\''+i+'\'] is ' + p[i]) } alert('id: '+p['id']); alert('id: '+p.id); Thanks, Jason ________________________________________ From: John Hjelmstad [[email protected]] Sent: Friday, May 21, 2010 7:35 PM To: [email protected] Subject: Re: Passing params to a view 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 < [email protected]> 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 [[email protected]] > Sent: Friday, May 21, 2010 5:23 PM > To: [email protected] > 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 > <[email protected]> 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 > > >
