dijit.layout.bordercontainer 隐藏所有内部内容
Posted
技术标签:
【中文标题】dijit.layout.bordercontainer 隐藏所有内部内容【英文标题】:dijit.layout.bordercontainer hides all inner contents 【发布时间】:2012-05-02 17:50:12 【问题描述】:我很难理解新版本 1.7.1 的 dojo 工具包并返回到 1.5 版本。我正在尝试包含边界容器来布局我的控件以匹配其中一个演示,但边界容器总是把事情搞砸。
http://download.dojotoolkit.org/release-1.6.1/dojo-release-1.6.1/dijit/themes/themeTester.html
我正在尝试重新创建以下内容,并且创建了菜单部分并执行了accordianContainer,但是如果我包含了bordercontainer,那么出现的只是一条看起来像容器消耗所有东西的线,我看不到内部组件包括菜单。 任何想法表示赞赏。
<body class="claro">
<form id="form1" runat="server">
<asp:ScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ScriptManager>
<div dojoType="dijit.Menu" id="submenu1" data-dojo-props='contextMenuForWindow:true, style:"display:none"' style="display: none;">
<div dojoType="dijit.MenuItem">Enabled Item</div>
<div dojoType="dijit.MenuItem" data-dojo-props="disabled:true">Disabled Item</div>
<div dojoType="dijit.MenuSeparator"></div>
<div dojoType="dijit.MenuItem" data-dojo-props="iconClass:'dijitIconCut'">Cut</div>
<div dojoType="dijit.MenuItem" data-dojo-props="iconClass:'dijitIconCopy'">Copy</div>
<div dojoType="dijit.MenuItem" data-dojo-props="iconClass:'dijitIconPaste'">Paste</div>
<div dojoType="dijit.MenuSeparator"></div>
<div dojoType="dijit.PopupMenuItem">
<span>Enabled Submenu</span>
<div dojoType="dijit.Menu" id="submenu2">
<div dojoType="dijit.MenuItem">Submenu Item One</div>
<div dojoType="dijit.MenuItem">Submenu Item Two</div>
<div dojoType="dijit.PopupMenuItem">
<span>Deeper Submenu</span>
<div dojoType="dijit.Menu" id="submenu4">
<div dojoType="dijit.MenuItem">Sub-sub-menu Item One</div>
<div dojoType="dijit.MenuItem">Sub-sub-menu Item Two</div>
</div>
</div>
</div>
</div>
<div dojoType="dijit.PopupMenuItem" data-dojo-props="disabled:true">
<span>Disabled Submenu</span>
<div dojoType="dijit.Menu" id="submenu3" style="display: none;">
<div dojoType="dijit.MenuItem">Submenu Item One</div>
<div dojoType="dijit.MenuItem">Submenu Item Two</div>
</div>
</div>
<div dojoType="dijit.PopupMenuItem">
<span>Different popup</span>
<div dojoType="dijit.ColorPalette"></div>
</div>
<div dojoType="dijit.PopupMenuItem">
<span>Different popup</span>
<div dojoType="dijit.Calendar"></div>
</div>
</div>
<div id="main" dojoType="dijit.layout.BorderContainer" design="sidebar">
<div id="header" dojoType="dijit.MenuBar" region="top">
<div dojoType="dijit.PopupMenuBarItem" id="edit">
<span>Edit</span>
<div dojoType="dijit.Menu" id="editMenu">
<div dojoType="dijit.Menu" id="Div1">
<div dojoType="dijit.MenuItem" id="cut" iconClass="dijitIconCut"
onClick="console.log('not actually cutting anything, just a test!')">Cut</div>
<div dojoType="dijit.MenuItem" id="copy" iconClass="dijitIconCopy"
onClick="console.log('not actually copying anything, just a test!')">Copy</div>
<div dojoType="dijit.MenuItem" id="paste" iconClass="dijitIconPaste"
onClick="console.log('not actually pasting anything, just a test!')">Paste</div>
<div dojoType="dijit.MenuSeparator" id="separator"></div>
<div dojoType="dijit.MenuItem" id="undo" iconClass="dijitIconUndo">Undo</div>
</div>
</div>
</div>
<div dojoType="dijit.PopupMenuBarItem" id="view">
<span>View</span>
<div dojoType="dijit.Menu" id="viewMenu">
<div dojoType="dijit.MenuItem">Normal</div>
<div dojoType="dijit.MenuItem">Outline</div>
</div>
<div dojoType="dijit.PopupMenuItem">
<span>Zoom</span>
<div dojoType="dijit.Menu" id="zoomMenu">
<div dojoType="dijit.MenuItem">50%</div>
<div dojoType="dijit.MenuItem">75%</div>
<div dojoType="dijit.MenuItem">100%</div>
<div dojoType="dijit.MenuItem">150%</div>
<div dojoType="dijit.MenuItem">200%</div>
</div>
</div>
</div>
<div dojoType="dijit.PopupMenuBarItem" id="themes">
<span>Themes</span>
<div dojoType="dijit.Menu" id="themeMenu"></div>
</div>
<div dojoType="dijit.PopupMenuBarItem" id="dialogs">
<span>Dialogs</span>
<div dojoType="dijit.Menu" id="dialogMenu">
<div dojoType="dijit.MenuItem" data-dojo-props="onClick: showDialog">slow loading</div>
<div dojoType="dijit.MenuItem" data-dojo-props="onClick: showDialogAb">action bar</div>
</div>
</div>
<div dojoType="dijit.PopupMenuBarItem" id="inputPadding">
<span>TextBox Padding</span>
<div dojoType="dijit.Menu" id="inputPaddingMenu">
<div dojoType="dijit.CheckedMenuItem" data-dojo-props="onClick:setTextBoxPadding, checked:true">theme default</div>
<div dojoType="dijit.CheckedMenuItem" data-dojo-props="onClick:setTextBoxPadding">0px</div>
<div dojoType="dijit.CheckedMenuItem" data-dojo-props="onClick:setTextBoxPadding">1px</div>
<div dojoType="dijit.CheckedMenuItem" data-dojo-props="onClick:setTextBoxPadding">2px</div>
<div dojoType="dijit.CheckedMenuItem" data-dojo-props="onClick:setTextBoxPadding">3px</div>
<div dojoType="dijit.CheckedMenuItem" data-dojo-props="onClick:setTextBoxPadding">4px</div>
<div dojoType="dijit.CheckedMenuItem" data-dojo-props="onClick:setTextBoxPadding">5px</div>
</div>
</div>
<div dojoType="dijit.PopupMenuBarItem" id="help">
<span>Help</span>
<div dojoType="dijit.Menu" id="helpMenu">
<div dojoType="dijit.MenuItem">Help Topics</div>
<div dojoType="dijit.MenuItem">About Dijit</div>
</div>
</div>
<div dojoType="dijit.PopupMenuBarItem" data-dojo-props="disabled:true">
<span>Disabled</span>
<div dojoType="dijit.Menu">
<div dojoType="dijit.MenuItem">You should not see this</div>
</div>
</div>
</div>
<div dojoType="dijit.layout.AccordionContainer"minSize="20" style="width: 300px;" id="leftAccordion" region="left" splitter="true">
<div dojoType="dijit.layout.ContentPane" title="Popups and Alerts"><div style="padding:8px">
</div>
</div><!-- end AccordionContainer -->
</div>
</div>
</form>
【问题讨论】:
【参考方案1】:让 BorderContainer 进行渲染可能很棘手。通常我发现这是尺码问题,而且尺码完全不对。
我通常会尝试:
-
用你的浏览器开发工具检查BorderContainer对应的,看看它的实际大小是多少。它通常类似于一个名为“Metrics”的选项卡,它指示容器的确切位置和大小,以及它的填充和边距发生了什么。有可能是 0px 高。
在您的 HTML 中,将 BorderContainer div 的宽度和高度明确设置为静态和硬编码(例如 style="width: 300px; height: 300px"),然后看看会发生什么。
【讨论】:
感谢您的帮助。你在道场工作/制作团队的一部分工作很多吗?是否有其他信息来源可以帮助解决有关道场的问题?不想一直打扰你? 在过去的几个月里,我一直在玩 Dojo。官方文档(三组:教程、参考指南和 API 文档 [按有用性降序排列!])和来源确实是最大的信息来源。【参考方案2】:我想,除了 Royston 解决方案之外,对我有用的只是这样做: dijit.byId("main").resize(); (其中“main”是 BorderContainer 的 id)。
【讨论】:
以上是关于dijit.layout.bordercontainer 隐藏所有内部内容的主要内容,如果未能解决你的问题,请参考以下文章