简体   繁体   English

带有Dojo / Dijit专用菜单栏的Spring Roo?

[英]Spring Roo with Dojo/Dijit declative menu bar?

I am trying to use the Dojo/Dijit declarative menu with Spring ROO 1.1.4, but even if I replace the complete roo generated menue.jspx with the example (ligthly addapted) from the Dojo/Dijit hompage, it does not replace the decorated menu divs with the menu. 我试图在Spring ROO 1.1.4中使用Dojo / Dijit声明性菜单 ,但是即使我用Dojo / Dijit hompage中的示例(适当地修改)替换了完整的roo生成的menue.jspx,它也不会替换装饰的菜单div与菜单。

that is how it look 就是这样

看起来如何

that is how should look: 那应该是什么样子:

看起来如何

My modified menu.jspx 我修改过的menu.jspx

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:menu="urn:jsptagdir:/WEB-INF/tags/menu"
    xmlns:sec="http://www.springframework.org/security/tags" 
    version="2.0">
    <jsp:directive.page contentType="text/html;charset=UTF-8" />
    <jsp:output omit-xml-declaration="yes" />

    <script type="text/javascript">
            dojo.require("dijit.MenuBar");
            dojo.require("dijit.PopupMenuBarItem");
            dojo.require("dijit.Menu");
            dojo.require("dijit.MenuItem");
            dojo.require("dijit.PopupMenuItem");
        </script>   
    </head>

        <div dojoType="dijit.MenuBar" id="navMenu">
            <div dojoType="dijit.PopupMenuBarItem">
                <span>
                    File
                </span>
                <div dojoType="dijit.Menu" id="fileMenu">
                    <div dojoType="dijit.MenuItem" onClick="alert('file 1')">
                        File #1
                    </div>
                    <div dojoType="dijit.MenuItem" onClick="alert('file 2')">
                        File #2
                    </div>
                </div>
            </div>
            <div dojoType="dijit.PopupMenuBarItem">
                <span>
                    Edit
                </span>
                <div dojoType="dijit.Menu" id="editMenu">
                    <div dojoType="dijit.MenuItem" onClick="alert('edit 1')">
                        Edit #1
                    </div>
                    <div dojoType="dijit.MenuItem" onClick="alert('edit 2')">
                        Edit #2
                    </div>
                </div>
            </div>
        </div>
</jsp:root>

Can anybody give me a hint what I am doing wrong? 有人可以提示我我做错了什么吗? (I know the fallback to do the menu programmatic, but I want to do it declarative.) (我知道可以通过程序来执行菜单的后备功能,但我想声明性地进行操作。)


The html header is looks like that: html标头如下所示:

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=8" />    

    ...
    <script type="text/javascript">var djConfig = {parseOnLoad: false, isDebug: false, locale: '${fn:toLowerCase(userLocale)}'};</script>

    <script src="${dojo_url}" type="text/javascript"><!-- required for FF3 and Opera --></script>
    <script src="${spring_url}" type="text/javascript"><!-- /required for FF3 and Opera --></script>
    <script src="${spring_dojo_url}" type="text/javascript"><!-- required for FF3 and Opera --></script>
    <script language="JavaScript" type="text/javascript">dojo.require("dojo.parser");</script>      


    <spring:message code="application_name" var="app_name"/>
    <title><spring:message code="welcome_h3" arguments="${app_name}" /></title>
</head>

I don't knows anything about Spring Roo, so maybe I'm saying something very stupid here... 我对Spring Roo一无所知,所以也许我在这里说的很愚蠢...

Is that menu.jspx compiling into some static html? 该menu.jspx是否可以编译为静态html? If this is the case, you can tell Dojo to parse your initial page simply by setting parseOnLoad to true on your djConfig 如果是这种情况,您可以简单地通过在djConfig上将parseOnLoad设置为true来告诉Dojo解析初始页面。

var djConfig = {parseOnLoad: true, ...}

(no need to require dojo.parser in this case). (在这种情况下,不需要dojo.parser)。

On the other hand, if that template is inserted dinamicaly, you will need to call dojo.parser.parse() on the root 'navMenu' node yourself. 另一方面,如果该模板是动态插入的,则需要自己在根“ navMenu”节点上调用dojo.parser.parse()。 You seem to be require-ing it, but I don't see where it is being called. 您似乎需要它,但是我看不到它的名称。

I had to use: { dojo.addOnLoad(function(){ dojo.parser.parse(); }); 我必须使用:{dojo.addOnLoad(function(){dojo.parser.parse();}); } }

instead of parseOnLoad:true 代替parseOnLoad:true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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