That confirms my suspicion as to why it isn't working.

Does anyone know of a work around to load files after the header?  I
know a stylesheet will load images on demand and not when the page
loads, is there another way I can actively load files instead of just
images?



On Aug 9, 5:09 pm, mdipierro <[email protected]> wrote:
> The problem with this approach is that you can longer embed widgets in
> regular views via {{=plugin_wiki.widget(name,**attr)}} because the
> response.files list would be updated after the response.files are
> included.
>
> Massimo
>
> On Aug 9, 4:43 pm, Chris S <[email protected]> wrote:
>
>
>
> > When using plugin_wiki (or just the LOAD command in general) is it
> > possible to somehow include response.files to include custom css and
> > js files?
>
> > It would be nice if I could only load .js files which are widget
> > specific if that widget is in use.  I really don't want to have to
> > load every .js file for every possible widget in a model (which
> > works).  Here's what I've tried simplified a bit.
>
> > In models/widgets.py
> > class PluginWikiWidgets:
> >     @staticmethod
> >     def mywidget(table='None',record_id=None):
> >     response.files.append(URL(request.application,'static/
> > widgets','widget.js'))
> >     // widget code
> >    return('widget.html',d)
>
> > In plugin_wiki body:
> > ``
> > name: mywidget
> > table: None
> > ``:widget
>
> > There is of course a 'widget.html' which renders the HTML portion of
> > the widget.
> > However, doing this none of my .js files load for the widget.  Moving
> > the response.files calls
> > before the class definition in the model works, but means that it's
> > loaded on every call to the application.
>
> > I've tried doing the response.files.append calls in the .html file at
> > the beginning but it's the same thing.
> > My suspicion is that the header is already loaded before plugin_wiki
> > renders the body and hence
> > the appended files are never loaded.  Is there a way around this?  It
> > would be much better if I could write
> > several widgets using different jQuery plugins and know that only the
> > widgets in use will get loaded when needed.

Reply via email to