Good morning.
I'm stuck trying to do simple widget with a CombBox.
My HTML look like this:
<div>
<div data-dojo-attach-point="selectTipo"></div>
</div>
My Widget.js is currently just this:
define(['dojo/_base/declare', 'jimu/BaseWidget', 'dijit/form/Select', 'dojo/data/ObjectStore', 'dojo/store/Memory', 'dojo/domReady!'],
function(declare, BaseWidget) {
return declare([BaseWidget], {
baseClass: 'jimu-widget-widgetprueba',
startup: function() {
this.inherited(arguments);
var store = new Memory({
data: [
{ id: "foo", label: "Foo" },
{ id: "bar", label: "Bar" }
]
});
var os = new ObjectStore({ objectStore: store });
var s = new Select({
store: os
}, this.selectTipo);
s.startup();
}
});
});
But when I run this in the demo, I get this error.
ReferenceError: Memory is not defined
I have added the 'dojo/store/Memory', so I don't understand what the problem is!
Thanks for any help!
Solved! Go to Solution.
You have to include the arguments in your function that refer to the modules you're adding in the define
define(['dojo/_base/declare', 'jimu/BaseWidget', 'dijit/form/Select', 'dojo/data/ObjectStore', 'dojo/store/Memory', 'dojo/domReady!'],
function(declare, BaseWidget, Select, ObjectStore, Memory) {
You have to include the arguments in your function that refer to the modules you're adding in the define
define(['dojo/_base/declare', 'jimu/BaseWidget', 'dijit/form/Select', 'dojo/data/ObjectStore', 'dojo/store/Memory', 'dojo/domReady!'],
function(declare, BaseWidget, Select, ObjectStore, Memory) {
Thanks! That worked!
Also to add to what Ken has said if you are going to include widget in your template then you need to have the mixin added as well:
define(['dojo/_base/declare', 'jimu/BaseWidget', 'dijit/_WidgetsInTemplateMixin', 'dijit/form/Select', 'dojo/data/ObjectStore', 'dojo/store/Memory', 'dojo/domReady!'],
function(declare, BaseWidget, _WidgetsInTemplateMixin, Select, ObjectStore, Mamory) {
return declare([BaseWidget, _WidgetsInTemplateMixin], {