以编程方式在 dijit 布局 TitlePane 中插入 dijit 内容窗格
inserting dijit content pane in dijit layout TitlePane programmatically
我正在尝试以编程方式将 dijit/layout/ 内容窗格添加到 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]
TitlePane 作为 属性 内容,您需要使用它来设置内容窗格
例 1:
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"
})
});
例 2:
var cp = new ContentPnae({
content:"Hello again, I'm CP within titlepane",
style:"background:yellow"
});
var titlePane = new dijit.TitlePane({
title:"This too",
open: false
});
titlePane .set('content',cp.domNode);
谢谢
皮特
[![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]
TitlePane 作为 属性 内容,您需要使用它来设置内容窗格
例 1:
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"
})
});
例 2:
var cp = new ContentPnae({
content:"Hello again, I'm CP within titlepane",
style:"background:yellow"
});
var titlePane = new dijit.TitlePane({
title:"This too",
open: false
});
titlePane .set('content',cp.domNode);