AnsweredAssumed Answered

Can't use Dojo declarative method

Question asked by FloCAD on Feb 22, 2017
Latest reply on Feb 23, 2017 by FloCAD

Hi everyone ! I've got an unknown problem from cyberspace ...

I'm beguining a new widget from the demowidget and i'm trying to put there a simple dojo checkbox (see my code below) and then, when i'm using the Programmatic example it's ok but when i'm using the declarative example, there is just a poor html input ... I really don't understand ...

 

My HTML :

<div>
<div>${nls.label1}.</div>
<input id="checkBox" /> <label for="checkBox">I agree</label>
<br />
<input id="param1" name="param1" data-dojo-type="dijit/form/CheckBox" value="param1" checked/>
<label for="param1">Calculer les intersections</label>

</div>

My JS :

define(['dojo/_base/declare', 'jimu/BaseWidget', 'dijit/form/CheckBox', 'dojo/domReady!', "dojo/parser"],
function (declare, BaseWidget, CheckBox) {
return declare([BaseWidget], {

baseClass: 'jimu-widget-testwidget',

postCreate: function () {
this.inherited(arguments);
console.log('postCreate');
},

startup: function () {
this.inherited(arguments);
console.log('startup');
},

onOpen: function () {
console.log('onOpen');
this.go();
},

onClose: function () {
console.log('onClose');
},

onMinimize: function () {
console.log('onMinimize');
},

onMaximize: function () {
console.log('onMaximize');
},

onSignIn: function (credential) {
/* jshint unused:false*/
console.log('onSignIn');
},

onSignOut: function () {
console.log('onSignOut');
},
go: function () {
var checkBox = new CheckBox({
name: "checkBox",
value: "agreed",
checked: false,
onChange: function(b){ alert('onChange called with parameter = ' + b + ', and widget value = ' + this.get('value') ); }
}, "checkBox").startup();
}
});
});

 

If someone can understand what happen ... 

Outcomes