gpt4 book ai didi

css - 在 DOJO 边界容器中创建列

转载 作者:太空宇宙 更新时间:2023-11-04 14:26:12 25 4
gpt4 key购买 nike

我想在我的页面中使用 DOJO 边框容器。我有这个 sample 。

    <script>
require(["dijit/layout/BorderContainer", "dijit/layout/ContentPane","dojo/domReady!"],
function(BorderContainer, ContentPane){
// create a BorderContainer as the top widget in the hierarchy
var bc = new BorderContainer({
style: "height: 300px; width: 500px;"
});

// create a ContentPane as the center pane in the BorderContainer
var cp2 = new ContentPane({
region: "center",
content: "how are you?,this is a test content"
});
bc.addChild(cp2);

// put the top level widget into the document, and then call startup()
bc.placeAt(document.body);
bc.startup();
});
</script>

我想创建一些列,使其看起来像一个表格。我怎样才能做到这一点??谁能帮帮我

最佳答案

根据您的标题,“创建列in Dojo BorderContainer”(强调我的),那么我会认为 dgrid , table container , 或 grid container边界容器内部会适合,具体取决于您试图用表格完成的任务。

如果表是放数据的,考虑dgrid。如果表格用于表单布局,请考虑表格容器。如果表格用于小部件布局,请考虑使用网格容器。

这是一个使用网格容器的例子。 nbZones 是列数。

<!DOCTYPE html>
<html>
<head>
<link href='//ajax.googleapis.com/ajax/libs/dojo/1.9.1/dijit/themes/claro/claro.css' rel='stylesheet' type='text/css' />
<link href='//ajax.googleapis.com/ajax/libs/dojo/1.9.1/dojox/widget/Portlet/Portlet.css' rel='stylesheet' type='text/css' />
<link href='//ajax.googleapis.com/ajax/libs/dojo/1.9.1/dojox/layout/resources/GridContainer.css' rel='stylesheet' type='text/css' />
<script src='//ajax.googleapis.com/ajax/libs/dojo/1.9.1/dojo/dojo.js'></script>
<style type='text/css'>
html,body,#border { margin:0; width:100%; height:100%; }
</style>
</head>
<body class='claro'>
<div id='border' data-dojo-type='dijit/layout/BorderContainer'>
<div id='grid'></div>
</div>
<script type='text/javascript'>
require(
['dojo/ready', 'dojo/parser', 'dojox/layout/GridContainer', 'dojox/widget/Portlet'],
function (ready, Parser, GridContainer, Portlet) {
ready(function () {
Parser.parse().then(function () {
// create grid and put into border container
var grid = new GridContainer({nbZones:3}, 'grid');

// create cells and put into grid
for (var i = 0; i < 30; i++) {
grid.addChild(new Portlet({
closable:false,
content:'(' + Math.floor(i/3) + ', ' + (i%3) + ')'
}));
}
grid.startup();
});
});
}
);
</script>
</body>
</html>

关于css - 在 DOJO 边界容器中创建列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19537149/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com