I'm not having problems w/ JSX.... :-)
It helps to "inline" jquery code directly if following code depends on
jquery already being loaded. If you refer to it to it in a script tag it
loads after you need it.. See
javascript magic/hack happening in these:
Hi,
I want to resurface this question in case it is something that could be
addressed in the 2.0 release. I have a macro that requires some js support
(jquery) and would thus like to have additional files referenced in the head
section of the page when the macro is used.
It was suggested that I could specify dependencies of css and js files for
a macro by using getPluging("jsfx") and invoking the use method.
From what I can tell this method does not work so I'm wondering if the
'context' obtained as suggested is not the proper context to add additional
elements to the rendered page.
Here is what I've done:
To get the context, I added this:
@Requirement
private Execution execution;
And then in my macro execution method I added the following:
ExecutionContext executionContext = execution.getContext();
XWikiContext context = (XWikiContext)
executionContext.getProperty("xwikicontext");
XWiki xwiki = context.getWiki();
AbstractSkinExtensionPlugin plugin = (AbstractSkinExtensionPlugin)
xwiki.getPlugin("jsfx", context);
plugin.use("/foo/bar.js",context);
When I utilize this from my macro execution callback it doesn't emit any
code in the header. (using jsfx as a velocity macro does work though).
Is the context obtained via this method the right one or is there a
different one somehow attached to the rendering agent?
Thanks,
Glenn
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs