views:

362

answers:

2

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?

A: 

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.

albert green
A: 

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

Philippe
No I did not. I didn't have that need. I just put absolute URLs instead of relative ones. I used Firebug to watch what was happening and then I saw the wrong URL calls.
albert green