On Monday, January 9, 2012 1:58:30 PM UTC-5, Liam wrote:
>
> Hi all,
>
> I'm currently writing a plugin for part of a bigger project that can take 
> some time doing processing server side and I'm trying to make it as modular 
> as possible; thus the plugins and components. The problem I'm trying to 
> solve is this: The application uses LOAD to embed some html generated by 
> the plugin in the page. A link in the LOADed html will start some analyses 
> and will be replaced by an image of a loading gif while waiting for the 
> analyses to complete and the html to be returned.
>

If you want to click a link in the component and have the contents of the 
component replaced with the response from that link, you can use the A() 
helper with the "cid" argument, as described 
here: http://web2py.com/books/default/chapter/29/12#Trapped-Ajax-links.

You would then have to add some Javascript code to display the "loading" 
gif while waiting.
 

>
> I've been trying to return javascript with the html from the plugin that 
> activates when the link is clicked without any success. I don't even know 
> if the javascript will be applied to the link in the html that it is 
> returned with. I've tried a few approaches:
> 1. Script elements seem to disappear if placed inside the view/controller.
>

Not sure what you mean by that -- can you show some code?
 

> 2. response.files.append(...) doesn't add a js script to the outer page's 
> files.
>

Right. response.files generally won't do anything when a component loads 
(unless the component view includes code that calls 
response.include_files(), which is generally not the case, and would be 
tricky for CSS files in particular, which must be loaded in the document 
head).

Anthony

Reply via email to