Login Register

ContentPane and href , maybe a bug!

Issue: I am using BorderContainer. I tried to render a TitlePane by including a div tag within the BorderContainer's ContentPane and I was able to render the widget, but when I try to use href attribute in ContentPane to refer to another html file that has a TitlePane and it’s dojo.require(“dijit.TitlePane”) declaration it gives me an error that it cannot load the class dijit.TitlePane. I confirmed that this is the case with all dijit widgets. I even confirmed that by using LayoutContainer’s ContentPane the errors were similar.

Code:
unittest.html
-------------------

<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>

    <script type="text/javascript" src="../js/dojo-release-1.1.0/dojo/dojo.js.uncompressed.js"
        djConfig="isDebug:true, parseOnLoad: true">

    </script>
       
    <style type="text/css">     
        @import "../js/dojo-release-1.1.0/dojo/resources/dojo.css";
        @import "../js/dojo-release-1.1.0/dijit/themes/tundra/tundra.css";
       
        html, body{
            height: 100%;
            width: 100%;
            margin: 0;
            padding: 0;
        }
        .layout1{
            height: 100%;
            width: 100%;
            margin: 0;
            padding: 0;
            border:0;           
        }
        </style>
       
        <script type="text/javascript">
            dojo.require("dojo.parser");
            dojo.require("dijit.layout.BorderContainer");
            dojo.require("dijit.layout.ContentPane");                           
         </script>           
           
</head>
<body class="tundra">
    <div dojoType="dijit.layout.BorderContainer" class="layout1">
        <div dojoType="dijit.layout.ContentPane" region="top" href="unittest_TitlePane.html" executeScripts="true" style="background-color:lightblue; height:100%;">                                   
        </div>
    </div>   
</body>

unittest_TitlePane.html
------------------------------------

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Editor Demo</title>
   
    <script type="text/javascript" src="../js/dojo-release-1.1.0/dojo/dojo.js.uncompressed.js;../js/dojo-release-1.1.0/dojo/dojo.js"
        djConfig="parseOnLoad: true">

    </script>
   
    <script type="text/javascript">
            dojo.require("dojo.parser");
              dojo.require("dijit.TitlePane");
              dojo.require("dijit.layout.ContentPane");                         
    </script>
         
    <style type="text/css">
        @import "../js/dojo-release-1.1.0/dojo/resources/dojo.css";
        @import "../js/dojo-release-1.1.0/dijit/themes/tundra/tundra.css";
        @import "../js/dojo-release-1.1.0/dijit/themes/tundra/tundra_rtl.css";
        @import "../js/dojo-release-1.1.0/dojo/tests/css/dijitTests.css";
       
        body {
            padding: 1em;
        }
       
        .formAnswer {
            background-color:#f5eede;
            padding:0.3em;
            margin-bottom:1em;
            width: 100%;
            border: 1px solid #9B9B9B;
        }
               
    </style>     
</head>
<body class="tundra">
   
        <div dojoType="dijit.layout.ContentPane" style="padding-top: 3em; padding-bottom: 1em; border-width:2px;">
          <div dojoType="dijit.TitlePane" title="Comments(0)" open="true" href="comments.html"></div>         
        </div>               
   
</body>

Work around: One of the person whom I was consulting suggested this work around - include the dijit.require(“dijit.TitlePane”) declaration in unittest.html.

Solutions: We think the called page should load the required packages by itself which is not happening right now.

Saw the same thing....

Yeah, I saw the same behavior from code similar to yours. I also thought that it should honor the dojo.require's from the href-loaded contentPane. After reading a bunch of stuff, I noticed this:

http://dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/layout/content-pa...

...which is talking about a linked (via href) contentPane. There is a sentence on that page that says: "Note here that the dojo.require for the tree is placed in the calling html.", that might be why we see this (though, honestly, if this is the case then it needs to be in the FAQ and a few other places). There appears to be some behavior difference between dojo.requiring a module (that has dojo.require's in it) versus contentPane-href'ing a module (that has dojo.require's in it).

I hope it's a bug .... I just ended up duplicating my requires in the parent page (but, then I used package manager to make custom libs, so it ended up being less "ugly" I guess, but still weird).

Dylan

Aha!

I may have found something .... check out the ContentPane over in dojox.Layout. It's the "advanced contentpane" and includes options that I think will do what you want (maybe). The 'executeScripts' looks promising. In searching the online docs, I found a dojo 0.4 page that seems to be missing in the 1.0 stuff (or I couldn't find it anyway) that describes a lot of those options in more detail (executeScripts, scriptScope, etc.).

Anyway, I could be wrong ... take a look around & post back if it works for you .... I imagine almost everyone new is going to try that at some point.

Dylan Tynan

Dijit ContentPane and HREF load not executing scripts

Here is a forum thread that explains everything:
http://www.dojotoolkit.org/forum/dijit-dijit-0-9/dijit-support/executesc...

This --really-- needs to get back into the regular documentation....