Grails 应用程序中的 Dojo Fisheye

发布于 2024-08-05 18:48:48 字数 2272 浏览 4 评论 0原文

我正在使用 Grails 构建一个 Web 应用程序。我决定使用 dojo,并在 main.gsp 中添加了一个 dojo 鱼眼菜单,这样它就可以在应用程序的所有页面上使用。 它适用于(主页)index.gsp 页面,但一旦我选择另一个页面,鱼眼菜单就会消失。如果我回到家,它就在那里。我修改了我的设置,一切看起来都很好。我没有使用任何花哨的东西,只是简单的东西。我错过了一些东西但无法弄清楚。

为了清晰起见,这里是我的 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>

请注意,模板(_fisheyebar)的使用不是原因,我把代码直接放在main中,效果是一样的。那么我错过了什么?

I am building a web application using Grails. I decided to use dojo and I added a dojo fisheye menu for begining in the main.gsp so it would be available on all the application's pages.
It works fine for the (home) index.gsp page, but once I select another one, the fisheye menu disapears. If I go back to home it is there. I revised my settings and everything looks ok to me. I am not using anything fancy, just simple things. I am missing something but not able to figure it out.

here is the code in my main.gsp simplified for clarity:

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

And here is the _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>

All the pages including the index.gsp have the following:

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

Please not that the usage of template (_fisheyebar) is not the cause, I put the code directly in the main and had the same effect. So what am I missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

柳若烟 2024-08-12 18:48:48

它位于 dojo 位置的相对 url 中。它是相对于根目录的,所以这就是索引起作用而不是其他页面起作用的原因。

使用绝对 URL 可以解决该问题。

it is in the relative url to dojo's location. it is relative to the root so that's why the index works and not the other pages.

using absolute URLs fixes the problem.

小嗷兮 2024-08-12 18:48:48

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

Did you try to move your dojo declaration and imports to your layout template page instead of putting it in your main.gsp ?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文