Hi Bryn, On 12 Aug 2015 at 12:09:56, Bryn Jeffries ([email protected](mailto:[email protected])) wrote:
Hi,
I'm experimenting with including some jQuery UI elements into some wiki pages using XWiki 7.1. As a test, I've been trying to get the spinner example from http://api.jqueryui.com/spinner/ to work:
I have constructed a minimal page, with content body: {{velocity}} {{html}}
{{/html}} {{/velocity}}
And for the page I've added an objects of type XWiki.JavaScriptExtension containing code: require(['jquery'], function($) { $( "#spinner" ).spinner(); });
However, viewing the page yields an error TypeError: a(...).spinner is not a function "require(["jquery"],function(a){a("#spinner").spinner()});"
So it looks as though the spinner UI code is missing, so I'm guessing I need to include the jQuery UI library somehow. I'm a little confused because there is a jquery-ui-1.11.1.jar file in /usr/lib/xwiki/WEB-INF/lib/ which led me to believe that it was already bundled with XWiki. http://platform.xwiki.org/xwiki/bin/view/DevGuide/FrontendResources says "Prototype is the only JavaScript library that is systematically shipped with any wiki page in XWiki." But it's a bit old.
Any pointers?
I’m far from a JS expert, but it seems your code is saying that it depends on jquery but not on jquery-ui and https://api.jqueryui.com/spinner/ seems to indicate that the spinner is located in jquery-ui… Try depending on jquery-ui maybe? Thanks -Vincent
Thanks,
Bryn