简体   繁体   English

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

[英]How to include checkbox in the title of dojo content pane present in AccordionContainer?

I tried some code similar to this: 我尝试了一些与此类似的代码:

<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>

You can add the checkbox to the title using direct html:: 您可以使用直接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'>

If you want the checkbox to be a widget, its a litter tougher since the title does not get parsed. 如果您希望复选框成为小部件,则由于标题不会被解析,因此其难度更大。 You can create the checkbox programmatically, then add it to the title. 您可以通过编程方式创建复选框,然后将其添加到标题中。 The title id will always be the _button_title 标题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 jsFiddle: http : //jsfiddle.net/theinnkeeper/D7rju/#base

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM