如何在AccordionContainer中的dojo内容窗格的标题中包含复选框?

时间:2014-08-02 16:08:40

标签: javascript dojo

我尝试了类似的代码:

<div id="markupAccordion" data-dojo-type="dijit/layout/AccordionContainer" data-dojo-props='style:"width: 400px; height: 300px; overflow: hidden"'>     
    <div id="pane11" data-dojo-type="dijit/layout/ContentPane" data-dojo-props='title:" i need some text boxes or buttons here", iconClass:"dijitEditorIcon dijitEditorIconCut",selected:true'>
        <p>
            Some Text
        </p>
    </div>
</div>

1 个答案:

答案 0 :(得分:0)

您可以使用直接html ::

将复选框添加到标题中
 <div id="pane12" data-dojo-type="dijit/layout/ContentPane" data-dojo-props='title:"<input type=\"checkbox\" id=\"dbox1\" checked> <label for=\"dbox1\">Want</label>", iconClass:"dijitEditorIcon dijitEditorIconCut",selected:true'>

如果你希望复选框是一个小部件,那么它的垃圾就会变得难以理解,因为标题不会被解析。您可以以编程方式创建复选框,然后将其添加到标题中。标题ID将始终为_button_title

require(["dijit/form/CheckBox", "dijit/registry", "dojo/dom-construct"], function (CheckBox, reg, dom) {
    var box1 = new CheckBox({
        id: "pbox1",
        checked: true,
    });
    dom.place(box1.domNode, "pane11_button_title", "first");
    box1.startup();

});

的jsfiddle:http://jsfiddle.net/theinnkeeper/D7rju/#base