Dojo InlineEditBox 不会初始化

Dojo InlineEditBox wouldn't initialize

本文关键字:初始化 InlineEditBox Dojo      更新时间:2023-09-26

尝试使用教程中描述的InlineEditBox。

代码尚未更改:

require(["dijit/InlineEditBox", "dijit/form/Textarea", "dojo/domReady!"], function(InlineEditBox, Textarea){
    var eb = new InlineEditBox({
        editor: Textarea,
        autoSave: false
    }, "ieb").startup();
});

出于某种原因,我遇到了一个错误:

TypeError: Cannot read property 'on' of null

运行debugger显示 InlineEditBox 从不初始化。 例如 new Button()创建一个小组件,如控制台中所示,而new InlineEditBox()返回 null。

我已经创建了一个jsfiddle,它按预期工作。

你能给我们看你的HTML代码吗?

<body class="claro">
<div id="ieb">
    When you click on this div you'll be able to edit it (in plain text).
    The editor's size will initially match the size of the (original) text, but will expand/contract as you type.
</div>
<script>
require(["dijit/InlineEditBox", "dijit/form/Textarea", "dojo/domReady!"], function(InlineEditBox, Textarea){
    var eb = new InlineEditBox({
        editor: Textarea,
        autoSave: false
    }, "ieb").startup();
});
</script>
</body>