我将创建一个新的类-工具栏与标准操作按钮**(添加,编辑,删除,刷新)**。我写了简单的类:
define([
"dojo/_base/declare",
"dijit/_WidgetBase",
"dijit/_TemplatedMixin",
"dijit/_WidgetsInTemplateMixin",
"dijit/Toolbar",
// Template for new widget
"dojo/text!/ui/widgets/StandardToolbar.html",
// Load dijit/form/Button widget as dependency for parsing template
"dijit/form/Button"
], function(declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, Toolbar, templateString){
return declare("app.StandardToolbar", [
_WidgetBase,
_TemplatedMixin,
_WidgetsInTemplateMixin,
Toolbar
], {
templateString: templateString
});
});
从基本工具栏扩展的模板:
<div class="dijit" role="toolbar" tabIndex="${tabIndex}" data-dojo-attach-point="containerNode">
<button data-dojo-type="dijit/form/Button" data-dojo-attach-point="addButton">Add</button>
<button data-dojo-type="dijit/form/Button" data-dojo-attach-point="editButton">Edit</button>
<button data-dojo-type="dijit/form/Button" data-dojo-attach-point="removeButton">Remove</button>
<button data-dojo-type="dijit/form/Button" data-dojo-attach-point="refreshButton">Refresh</button>
</div>
而且它不起作用。工具栏中的按钮呈现为标准的HTML按钮,而不是Dojo小部件。我做错了什么?
1条答案
按热度按时间epfja78i1#
我认为您只是错过了在模板containerNode div中设置dojo类型
data-dojo-type='dijit/Toolbar'
。您必须设置:
x一个一个一个一个x一个一个二个x