Grails应用程序中的Dojo Fisheye

Grails应用程序中的Dojo Fisheye,grails,dojo,fisheye,Grails,Dojo,Fisheye,我正在使用Grails构建一个web应用程序。我决定使用dojo,并在main.gsp中添加了一个dojo鱼眼菜单,以便在应用程序的所有页面上都可以使用它。 它在home index.gsp页面上运行良好,但一旦我选择了另一个页面,鱼眼菜单就会消失。如果我回家,它就在那里。我修改了设置,一切看起来都很好。我没有使用任何花哨的东西,只是简单的东西。我漏掉了一些东西,但却找不出答案 以下是为清晰起见简化的my main.gsp中的代码: <html> <head>

我正在使用Grails构建一个web应用程序。我决定使用dojo,并在main.gsp中添加了一个dojo鱼眼菜单,以便在应用程序的所有页面上都可以使用它。 它在home index.gsp页面上运行良好,但一旦我选择了另一个页面,鱼眼菜单就会消失。如果我回家,它就在那里。我修改了设置,一切看起来都很好。我没有使用任何花哨的东西,只是简单的东西。我漏掉了一些东西,但却找不出答案

以下是为清晰起见简化的my main.gsp中的代码:

<html>
<head>

    ...

    <g:layoutHead />

    <!-- use dojo library ... this has not effect at all -->
    <g:javascript library="dojotk"/>    

    <!-- Load Dojo -->
    <script type="text/javascript" src="js/dojotk/dojo/dojo.js"
    djConfig="parseOnLoad:true, isDebug:false"></script>

    <!-- need fisheye -->
    <g:javascript type="text/javascript">
        dojo.require("dojox.widget.FisheyeList");
    </g:javascript>

    <!-- required css for dojo fisheye -->
    <style type="text/css">@import "js/dojotk/dojox/widget/FisheyeList/FisheyeList.css";</style>    

</head>
<body >
       ...
     <!-- fisheye bar -->
     <div id="fisheyebar"><g:render template="/common/fisheyebar"/></div>

    <g:layoutBody /> 
</body>
这是_fisheyebar.gsp

<g:javascript>
  function load_app(target){
   window.location.href=target
 }
</g:javascript>
    <center >
        <div class="outerbar">
            <div dojoType="dojox.widget.FisheyeList"
                    itemWidth="50" itemHeight="50"
                    itemMaxWidth="200" itemMaxHeight="200"
                    orientation="horizontal"
                    effectUnits="2"
                    itemPadding="10"
                    attachEdge="top"
                    labelEdge="bottom"

                    >
    <div dojoType="dojox.widget.FisheyeListItem" 
            onClick= "load_app('${createLinkTo(dir:'/something')}');"
             iconsrc="images/icon_something.png" caption="Web Browser">
    </div>
       .....
    </div>
</div> <!-- outbar -->
</center>
包括index.gsp在内的所有页面都有以下内容:

   <head>
<title>some titel</title>
<meta name="layout" content="main" />
</head>

请不要认为模板的使用不是原因,我把代码直接放在主代码中,并产生了相同的效果。那么我遗漏了什么呢?

它位于dojo位置的相对url中。它是相对于根的,所以这就是为什么索引工作,而不是其他页面


使用绝对URL解决了问题。

是否尝试将dojo声明和导入移动到布局模板页面,而不是将其放在main.gsp中?

否我没有。我没有那种需要。我只是把绝对的网址,而不是相对的。我用Firebug来观察发生了什么,然后我看到了错误的URL调用。