[英]How to get TabContainers and Spring Roo with Dojo 1.9.x working?
I am attempting to update my Spring Roo project with Dojo 1.9.3 我正在尝试使用Dojo 1.9.3更新我的Spring Roo项目
I have updated my web-resources with dojo-1.9.3 folder and code. 我已经用dojo-1.9.3文件夹和代码更新了Web资源。
I have updated my load-scripts.tagx to reference the new version instead of the default one. 我已经更新了load-scripts.tagx以引用新版本,而不是默认版本。
I have even removed the references of spring-js in the pom.xml and in the load-scripts.tagx. 我什至在pom.xml和load-scripts.tagx中都删除了spring-js的引用。
My TabContainer is not rendering. 我的TabContainer没有呈现。
I decided to do the simplest page possible. 我决定做尽可能简单的页面。 I have copied part of the following from the dojo website. 我已经从dojo网站复制了以下内容的一部分。
<div >
<script>dojoConfig = {parseOnLoad: true}</script>
<script>
require(["dojo/parser", "dijit/layout/TabContainer", "dijit/layout/ContentPane"]);
</script>
<div style="width: 350px; height: 300px">
<div data-dojo-type="dijit/layout/TabContainer" style="width: 100%; height: 100%;">
<div data-dojo-type="dijit/layout/ContentPane" title="My first tab" data-dojo-props="selected:true">
Lorem ipsum and all around...
</div>
<div data-dojo-type="dijit/layout/ContentPane" title="My second tab">
Lorem ipsum and all around - second...
</div>
<div data-dojo-type="dijit/layout/ContentPane" title="My last tab" data-dojo-props="closable:true">
Lorem ipsum and all around - last...
</div>
</div>
Does anybody know why this is not rendering? 有人知道为什么不渲染吗?
UPDATE: The problem with the rendering was my own fault. 更新:渲染问题是我自己的错。 I had javascript interfering with the parsing of the divs. 我有JavaScript干扰了div的解析。 I go ahead and mark my answer below as correct since that is one way to work around it. 我继续在下面将我的答案标记为正确,因为这是解决该问题的一种方法。
If I change from declarative to programatic I can get this to work. 如果我从声明式更改为程序化,则可以使用它。
below i paste in the jspx I tested successful with. 下面我粘贴成功测试的jspx。
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<div xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:spring="http://www.springframework.org/tags"
version="2.0">
<jsp:directive.page contentType="text/html;charset=UTF-8" />
<jsp:output omit-xml-declaration="yes" />
<script>
require(["dijit/layout/TabContainer", "dijit/layout/ContentPane", "dojo/domReady!"], function(TabContainer, ContentPane){
var tc = new TabContainer({
style: "height: 100%; width: 100%;"
}, "myTabContainer");
var cp1 = new ContentPane({
style:"height:125px",
title: "tab 1"
}, "editTab");
tc.addChild(cp1);
var cp2 = new ContentPane({
style:"height:125px",
title: "tab 2"
}, "editTab2");
tc.addChild(cp2);
var cp3 = new ContentPane({
style:"height:125px",
title: "tab 3"
}, "editTab3");
tc.addChild(cp3);
tc.startup();
});
</script>
<div style="width: 350px; height: 290px">
Test
<div id="myTabContainer">
<div id="editTab">tab 1</div>
<div id="editTab2">tab 2</div>
<div id="editTab3">tab 3</div>
</div>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.