Think something like this should work? Can't guarantee it because i have not implemented it myself yet. Perhaps it would be handy if you could show your code.
define([
"dojo/_base/declare",
"mxui/widget/_WidgetBase",
"dijit/_TemplatedMixin",
"mxui/dom",
"dojo/dom",
"dojo/dom-prop",
"dojo/dom-geometry",
"dojo/dom-class",
"dojo/dom-style",
"dojo/dom-construct",
"dojo/_base/array",
"dojo/_base/lang",
"dojo/text",
"dojo/html",
"dojo/_base/event",
//Added Big library as module
"big/big.min",
"WidgetName/lib/jquery-1.11.2.min",
"dojo/text!WidgetName/widget/template/WidgetName.html"
], function(declare, _WidgetBase, _TemplatedMixin, dom, dojoDom, dojoProp, dojoGeometry, dojoClass, dojoStyle, dojoConstruct, dojoArray, dojoLang, dojoText, dojoHtml, dojoEvent, _big, _jQuery, widgetTemplate) {
"use strict";
var $ = jQuery.noConflict(true);
// Declare widget's prototype.
return declare('Test.widget.Test', [_WidgetBase, _TemplatedMixin], {
var biggie = new Big();
mx.data.get({
guid: "yourMendixObjectGUID",
callback: function(obj) {
console.log("Received MxObject with GUID " + obj.getGUID());
biggie = obj.get("DecimalAttributeName");
console.log(biggie);
}
});
}
Could you perhaps share your code example in some way?
I guess because the define() function is lazy, while the require() function isn’t. Modules imported in the define() function, will only be imported at the moment they’re imported in another require() statement. So I'm guessing that might be what was missing because it is very unlikely any of the other modules loaded by the default widget template require big.js.
require({
packages: [{
//The name might actually have to be big/big
name: 'big',
//And I'm not sure if this correct path to the default libraries in Mendix
location: 'mxclientsystem/big/',
main: 'big.min'
}]
}, define([
"dojo/_base/declare",
"mxui/widget/_WidgetBase",
"dijit/_TemplatedMixin",
"mxui/dom",
"dojo/dom",
"dojo/dom-prop",
"dojo/dom-geometry",
"dojo/dom-class",
"dojo/dom-style",
"dojo/dom-construct",
"dojo/_base/array",
"dojo/_base/lang",
"dojo/text",
"dojo/html",
"dojo/_base/event",
"big/big",
"WidgetName/lib/jquery-1.11.2.min",
"dojo/text!WidgetName/widget/template/WidgetName.html"
],function(declare, _WidgetBase, _TemplatedMixin, dom, dojoDom, dojoProp, dojoGeometry, dojoClass, dojoStyle, dojoConstruct, dojoArray, dojoLang, dojoText, dojoHtml, dojoEvent, big, _jQuery, widgetTemplate) {
"use strict";
if (typeof big === 'undefined') {
throw 'This widget requires Big.js to be loaded first';
}
var $ = jQuery.noConflict(true);
// Declare widget's prototype.
return declare('Test.widget.Test', [_WidgetBase, _TemplatedMixin], {
var biggie = new Big();
mx.data.get({
guid: "yourMendixObjectGUID",
callback: function(obj) {
console.log("Received MxObject with GUID " + obj.getGUID());
biggie = obj.get("DecimalAttributeName");
console.log(biggie);
}
});
}
})
The big library doesn't seem to be included when creating a deployment package, when browsing to projectfolder/deployment/data/tmp/
there is no big reference there, which could explain why the library cannot be found. Perhaps copying the Big.js files to the widget folder will fix your issue. Meaning you will have to load the big library from inside your widget folders similar to how Jquery is loaded.