简体   繁体   中英

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

I have updated my web-resources with dojo-1.9.3 folder and code.

I have updated my load-scripts.tagx to reference the new version instead of the default one.

I have even removed the references of spring-js in the pom.xml and in the load-scripts.tagx.

My TabContainer is not rendering.

I decided to do the simplest page possible. I have copied part of the following from the dojo website.

<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. 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.

<?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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM