以编程方式在dijit布局TitlePane中插入dijit内容窗格

时间:2018-05-02 19:37:38

标签: javascript dojo

enter image description here我正在尝试以编程方式将dijit / layout / content窗格添加到dijit / title窗格。我遇到的问题是我无法让内容窗格进入标题窗格,它放在它下面。我的代码是这样的: 任何想法我做错了什么?

由于

皮特

[![require(\[
            "dijit/TitlePane",
            "dijit/layout/ContentPane",
            "dojo/dom",
            "dojo/domReady!"
        \], function (TitlePane, ContentPane, dom) {

            //create the title pane to hold the layer list
            var tp = new TitlePane({ title: "Layers", id: "tp" });
            dom.byId("viewDiv").appendChild(tp.domNode);
            tp.startup();

            var cp = new ContentPane({ id: "cp", content: "Test" });
            cp.placeAt("tp");
            cp.startup();
            dom.byId("tp").appendChild(cp.domNode);

        });][1]][1]

1 个答案:

答案 0 :(得分:1)

TitlePane作为属性内容,您需要使用它来设置contentpane

前1:

<select>

前2:

var titlePane = new dijit.TitlePane({
        title:"This",    
        open: false,
        content: new ContentPane({
            content:"Hello, I'm content pane inside a title pane",
            style:"background:red"
        })
    });