There is an example widget using JQuery in {WAB root}/client/stemapp/widgets/samplewidgets/UseJQuery
and the code can be easily adapted for other versions of JQuery. However, I want to use JQueryUI as well. I tried to duplicate jimu/loaderplugins/jquery-loader
within the require array in the define statement:
'jimu/loaderplugins/jquery-loader!http://code.jquery.com/jquery-1.9.1.min.js',
'jimu/loaderplugins/jquery-loader!http://code.jquery.com/ui/1.10.3/jquery-ui.min.js'
But since doing this, the widget doesn't open in webappviewer and its code is no longer visible to FireBug, so this clearly is not the way. Seems I need some jqueryUI-loader
, not existing in the standard jimu/loaderplugins
directory. Is there any way to enable JQueryUI on the widget level, or do I need to configure init.js, hack the WAB code or even write my own jqueryUI-loader
?
EDIT: I found an example of including the library in the head of Widget.html
file. AFAIK widget templates should be short snippets not containing the head section so this seems too hacky and I would expect some trouble after doing this. Is this the only way to do it on the widget level?
I plan to publish the widgets to more apps, including those owned by those outside our organization, so tweaking the widget is preferred to doing it anywhere else. Changing WAB is not completely out of question though, if it's cleaner than this one.