On 2 Aug 2012, at 16:48, Franklin, Matthew B. wrote: >> -----Original Message----- >> From: Scott Wilson [mailto:[email protected]] >> Sent: Thursday, August 02, 2012 10:28 AM >> To: [email protected] >> Subject: Re: AW: Allowing users to add widgets without page refresh >> >> On 2 Aug 2012, at 14:21, René Peinl wrote: >> >>> Hi everybody, >>> couldn't you establish a new JSP page that renders only one widget on the >>> server-side and then insert the result into the existing page using AJAX on >>> the client-side? >>> The only problem could be the page context, that might play a role for the >>> widget and would not be available be default in this solution. >> >> Having had a go at using a client-side template and encountering a lot of >> problems with impact on other scripts, I think this may be the best approach >> - >> thanks René. > > Personally, I am not a huge fan of grabbing rendered HTML via AJAX calls and > stuffing it into the page. What do others think? > > Scott- what issues did you find?
There are other calls in rave that iterate over widget wrappers, assuming they all contain actual region widgets and failed when I tried to include the client template, so I'd need to change them to skip the hidden "template" wrapper. > >> >>> Regards >>> René >>> >>> -----Ursprüngliche Nachricht----- >>> Von: Franklin, Matthew B. [mailto:[email protected]] >>> Gesendet: Donnerstag, 2. August 2012 13:48 >>> An: [email protected]; [email protected] >>> Betreff: RE: Allowing users to add widgets without page refresh >>> >>>> -----Original Message----- >>>> From: Scott Wilson [mailto:[email protected]] >>>> Sent: Thursday, August 02, 2012 7:16 AM >>>> To: [email protected] >>>> Subject: Allowing users to add widgets without page refresh >>>> >>>> Hi everyone, >>>> >>>> We have a requirement from the OMELETTE project to add widgets to the >>>> page without the user having to refresh the page - for example for a >>>> "page helper" widget to find and then add a widget to the page for the >>>> user. (see RAVE-743). >>>> >>>> The basic approach would seem to be adding an RPC method for adding a >>>> widget to the page and then rendering it in the page. So, e.g. >>>> rave.api.rpc.addWidgetToPageAndRender. >>> >>> For what it is worth, IMO this is 2 calls. One to the API endpoint that >>> already exists and another to a new rave function that does the rendering. >>> I don't think that the api js namespace should be involved in rendering. >>> >>>> >>>> I've looked into the requirements for this, and what I'm currently >>>> stuck against is the use of JSP tags to render the widget "chrome"; >>>> this isn't accessible from the client side so its not really possible >>>> at the moment to add a widget to the page without a page refresh. >>>> >>>> One possibility is to move the region_widget.tag code into client-side >>>> JS templating. However, there is then an issue with localization. >>>> Alternatively, the logic could be moved from a JSP tag into a Java class >>> and executed via RPC. >>>> However, that will make for some really messy code. >>>> >>>> Can anyone think of any better solutions for this? >>> >>> I think that the best approach might be to generate a client side template >>> for a widget using the JSP tags. This might take some tweaking of the >>> existing template, but would allow you to make one more call to the tags to >>> render out a hidden template that can be used to render new gadgets. >>> >>>> >>>> S >>> >
