嗨,我将设置新的按钮设置为禁用. 我正在使用Dojo 1.8 请参阅我的代码: require(["dojo/parser", "dijit/layout/BorderContainer","dijit/form/Button","dojo/on","dijit/form/Select","dojo/store/Memory", "dojo/request","dojo
我正在使用Dojo 1.8
请参阅我的代码:
require(["dojo/parser", "dijit/layout/BorderContainer", "dijit/form/Button","dojo/on","dijit/form/Select", "dojo/store/Memory", "dojo/request","dojo/domReady!" ], function(parser, BorderContainer, Button, on, Select, Memory, request) { var btn4 = new Button // Button, not button ({ label: "Number of cards", this.set("disabled", false) // This code that disables the button },"btn4"); btn4.startup(); })
我在Dojo或谷歌找不到帮助.
首先,尝试在dijit的参数列表中调用this.set()没有意义,因为还没有创建dijit.其次,dijit的第一个参数始终是带有键/值对的标准JavaScript对象.尝试在对象声明的中间插入函数调用只是代码本身的语法错误.最后,没有必要尝试使用dijit的设置器.只需将禁用:在参数列表中的true为Button dijit.
var btn4 = new Button({ label: "Number of cards", disabled: true, }, "btn4");
看这个Fiddle.