0 Replies Latest reply on Jul 20, 2008 7:01 PM by amouradi

    problems using dojo/dijit

    amouradi Newbie

      Hello,

      I was wondering if anyone succeeded using dojo dijits in their portlets. I have tried using elements with defined dojoType, and they are not being rendered correctly, it seems dojo is not parsing dijits on the page.
      If I add them programmatically, that sort of works, but then still not rendered correctly. I am using this code to include css and dojo.js.

      <style type="text/css">
       @import "<%=request.getContextPath()%>/scripts/dojo/dojo/resources/dojo.css";
       @import "<%=request.getContextPath()%>/scripts/dojo/dijit/tests/css/dijitTests.css";
       @import "<%=request.getContextPath()%>/scripts/dojo/dijit/themes/tundra/tundra.css";
       .dj_ie INPUT#setvaluetest { font-family: Courier; }
       </style>
      <div id="scripts_<portlet:namespace/>"> </div>
      
       <script type="text/javascript">
      
       function getJsFile_<portlet:namespace/>(jsFile) {
       return "<%=request.getContextPath()%>" + jsFile ;
       }
       //this creates separate namespace for dojo
       if (typeof dojo == "undefined") {
       /* Build script tag. */
       var script = document.createElement("script");
       script.src = getJsFile_<portlet:namespace/>("/scripts/dojo/dojo/dojo.js");
       script.type= "text/javascript";
       script.djConfig = "isDebug: true, parseOnLoad:true";
      
       /* Insert at the top of portlet scripts_<namespace>. */
       var scripts_<portlet:namespace/> = document.getElementById("scripts_<portlet:namespace/>");
       scripts_<portlet:namespace/>.insertBefore(script, scripts_<portlet:namespace/>.firstChild);
       }
      
       </script>
      
      <script type="text/javascript">
       dojo.require("dojo.parser");
       dojo.require("dojo.date");
       dojo.require("dijit.form.FilteringSelect");
       dojo.require("dijit.form.Form");
       dojo.require("dojo.data.ItemFileReadStore");
       ..... etc


      Anyone had more luck than me? Please help, would really appreciate!

      Thanks!
      Ann