I believe dojox was not included in the build mendix uses.
As a work around you could include the parts of dojox you want into your own app and set the moduleUrl using dojo.registerModulePath
.
Example (from the top of my head):
dojo.provide( "FancyWidget" ); // We know that dojox (or atleast the parts we need) are in a subfolder // of the widget we are writing. dojo.registerModulePath( "dojox", dojo.moduleUrl( "FancyWidget" ) + "/lib/dojox/" ); // Now the loader knows we have a module called dojox and where to find // it. So this will work. dojo.require( "dojox.grid.EnhancedGrid" );
There is one downside though if another app would do the same (register a module called dojox) it could cause a collision and both wouldn't work.
Best way is to include the dojox files in your widget and use dojo.require to load it.
Edit: Which element are you referring to? The dojo require only loads the relevant dojox code into the client, making it available for your widget. You will still need to create a new instance for the actual widget.
You can take a look at the Slider widget on the AppStore. It requires the dijit.form.Slider and uses this to create a new dijit.form.HorizontalSlider() after the applyContext.
I'm also trying to include the dojox-files in my widget, and then use dojo.require to load them, and this works fine for my own js-file. But the individual dojox-files also use dojo.require, which still results in this error, because of an incorrect path:
http://localhost:8080/mxclientsystem/dojox/grid/DataGrid.js?321Failed to load resource: the server responded with a status of 404 (Not Found)
I tried bulk-replacing all the
dojo.require(dojox.something)
statements in the individual dojox-files to
dojo.require(module.widget.dojox.something)
but changing all the dojox-files doesn't seem like the way to go? This step did solve the 404 not found error, but now the page tells me:
Unable to render widget: Cannot call method 'getPlugin' of undefined Without any errors in the javascript or mendix-console.
Any ideas on how to set the dojox-path effectively?
I'm also trying to include the dojox-files in my widget, and then use dojo.require to load them, and this works fine for my own js-file. But the individual dojox-files also use dojo.require, which still results in this error, because of an incorrect path:
http://localhost:8080/mxclientsystem/dojox/grid/DataGrid.js?321Failed to load resource: the server responded with a status of 404 (Not Found)
I tried bulk-replacing all the
dojo.require(dojox.something)
statements in the individual dojox-files to
dojo.require(module.widget.dojox.something)
but changing all the dojox-files doesn't seem like the way to go? This step did solve the 404 not found error, but now the page tells me:
Unable to render widget: Cannot call method 'getPlugin' of undefined Without any errors in the javascript or mendix-console.
How to set the dojox-path effectively?
Good registerModulePath sounds like what I need; but I'm having trouble to find out the correct configuration; My file is located in widgets\custommodule\DragDropWidget\DragDropWidget.js and dojox is in widgets\custommodule\DragDropWidget\dojox
So I declare
dojo.provide( "custommodule.DragDropWidget.DragDropWidget" );
dojo.registerModulePath( "dojox", "../" + dojo.moduleUrl( "custommodule.DragDropWidget" ) + "dojox" );
This still gives me the 404 error, when the path seems correct to me??
http://localhost:8080/mxclientsystem/widgets/custommodule/DragDropWidget/dojox/grid/EnhancedGrid.js?321