Hi Francisco,
The problem was the structure of the widget js. It was using require instead of define. I have updated the widget on github and will now publish a new release to the appstores now for you.
You can see my changes here:
https://github.com/simo101/CookieBannner/commit/92f52c7876c3e3d8fde53963679bb0a500dcc5aa
Regards
Simon
Hi Francisco,
There are a couple of widgets which use jQuery. You can take a look at them and see how they do it.
For example: https://github.com/mendix/HTMLSnippet
require(["MyWidget/lib/jquery"],
lang.hitch(this, this.FunctionWhereIdoSomethingWithJqeury));
-Andrej
Francisco,
Are you using this widget?
https://appstore.home.mendix.com/link/app/1022/
If so you may need to change the require statements in here:
https://github.com/simo101/CookieBannner/blob/master/src/CookieCuttr/widget/CookieCuttr.js
Hi Simon
Yes. We are using your widget. The references to the js files exist, but it looks like the widget is loaded before the JavaScript references.
We have tried by using this in index.HTML:
<script src="widgets/CookieCuttr/lib/jquery-1.11.2.js?{{cachebust}}"></script>
But when we deploy to the cloud, it's conflicting (not in local) with a different jquery of another widget (CK Editor). It Works fine locally (weird)
There seems to be a conflict at bundling, since we have many jQuery script files, but we're forcing one of them in the index.HTML
Once we have enabled bundling local, we have got the same issue as in the cloud.
The problem is that if we don't forcé the JS files to load in index.HTML, the widget is not working as the scripts have not been loaded when the widget is called.
If we run the JS latter from the console, it Works fine.
I managed to make it work temporarily by calling it in the index.HTML using JavaScript directly. However, I'll be updating it today to your last versión after you publish it in the App store.
Many thanks