0

我有以下工具栏,我想在工具栏的开头添加“按钮”一词:http: //jsfiddle.net/yyzxW/

 <div id="toolbar1" data-dojo-type="dijit/Toolbar" style="background-color:inherit;background-image:none;border-bottom:0px;">
 <span data-dojo-type="dijit/ToolbarSeparator">Buttons:</span>
 <div data-dojo-type="dijit/form/Button" id="toolbar1.pan" data-dojo-props="iconClass:'PanIcon', showLabel:false">פאן</div>
            <div data-dojo-type="dijit/form/Button" id="toolbar1.copy" data-dojo-props="iconClass:'dijitEditorIcon dijitEditorIconCopy', showLabel:false">Copy</div>
            <div data-dojo-type="dijit/form/Button" id="toolbar1.paste" data-dojo-props="iconClass:'dijitEditorIcon dijitEditorIconPaste', showLabel:false">Paste</div>
            <!-- The following adds a line between toolbar sections-->
            <span data-dojo-type="dijit/ToolbarSeparator"></span>
            <div data-dojo-type="dijit/form/ToggleButton" id="toolbar1.bold" data-dojo-props="iconClass:'dijitEditorIcon dijitEditorIconBold', showLabel:false">Bold</div>
        </div>

另外,如果我这样创建工具栏,我该如何编程:

 var toolbar = new Toolbar({
            id: "toolbar1",
            style: "background-color:inherit;background-image:none;border-bottom:0px;"
        });

        var btnPan = new ToggleButton({
            label: "Pan",
            id: controls.PAN,
            onClick: function () { deactivateControls(); },
            showLabel: true,
            iconClass: "ToolbarIcon Pan"
        });

        var btnZoomIn = new ToggleButton({
            label: "Zoom In",
            id: controls.ZOOM_IN,
            onClick: function () { activateControl(this.id); },
            showLabel: true,
            iconClass: "ToolbarIcon ZoomIn"
        });

        var btnZoomOut = new ToggleButton({
            label: "Zoom Out",
            id: controls.ZOOM_OUT,
            onClick: function () { activateControl(this.id); },
            showLabel: true,
            iconClass: "ToolbarIcon ZoomOut"
        });

        toolbar.addChild(btnPan);
        toolbar.addChild(btnZoomIn);
        toolbar.addChild(btnZoomOut);
4

2 回答 2

1

查看我的 jsfiddle 修改版本http://jsfiddle.net/yyzxW/3/

将此样式放入 div

 <div style='float:left;margin-top:3px;'>Buttons: </div>

对于编程代码,您可以使用 dojo.create 或 put-selector 在 toolBar.containerNode 中创建一个 div,例如

put(toolBar.containerNode, "div.yourClass", "Your text");
于 2013-10-05T15:10:35.513 回答
1

您可以只创建一个禁用按钮。

<div data-dojo-type="dijit/form/Button" 
    data-dojo-props="'class': 'labelOnlyButton', disabled: true">Buttons:</div>

用于.labelOnlyButton创建 css 以使其看起来像您想要的那样。

于 2013-10-05T15:10:40.483 回答