Topic
4 replies Latest Post - ‏2013-06-18T15:11:42Z by NiladriChakraborty
NiladriChakraborty
NiladriChakraborty
11 Posts
ACCEPTED ANSWER

Pinned topic DOJO not getting enabled

‏2013-06-16T15:16:38Z |

Hi,

I  am using WEF 8. I previously worked in WPF 6.1.5. dojo.addOnLoad() worked fine in that version. But it's not getting enabled in this version. I remember there was a builder "DOJO Enable" in that version to enable each package of dojo. As WEF referring to dojo 1.7 I tried to use ready function too. Please guide to enable dojo. PFA the model using dojo. dojo code is in the page builder. I added dojo during the project creation though.

Thanks,

Niladri

Attachments

  • mburati
    mburati
    2551 Posts
    ACCEPTED ANSWER

    Re: DOJO not getting enabled

    ‏2013-06-17T02:50:54Z  in response to NiladriChakraborty

    If you're using WEF8 with default settings in a new project, then Smart Refresh (AJAX based partial page) action controls will add base dojo to the page so you shouldn't need a Dojo Enable just for that.   Your test model has no WEF button or link actions, so that wouldn't have pulled it in yet.   There is still a Dojo Enable builder in WEF8, but it's not a typically used builder - it comes into play more when you need to add a Dojo require of a package not already required by a WEF builder leveraging Dojo and/or WEF RDD leveraging Dojo.

    Note, when running in portal, it's the portal page that should be pulling in Dojo itself, not the portlet.   Portal6.1.5 would pull in Dojo automatically, but in Portal 8,  you need to specify a Portal Page Theme Profile for your portal page, that pulls in Dojo.   By default profile_full  portal profile pulls in Dojo, but it's usually better to define your own profile that pulls in only the portal theme modules that you really need to use, rather than all of the modules that portal's full profile pulls in.

    Note, for standalone testing, it looks like in WEF8 that your script may have come before the line of script where WEF loads Dojo if needed.   Moving your inline script out of the head and into the body made your second alert show up, after I added a Dojo Enable builder to the page.

     

    I hope that info helps,
    ..Mike Burati 
    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
    • NiladriChakraborty
      NiladriChakraborty
      11 Posts
      ACCEPTED ANSWER

      Re: DOJO not getting enabled

      ‏2013-06-17T07:05:35Z  in response to mburati

      Thank you Mike for so much information. It gives complete picture. Just a question came in my mind, WEF 8 supports DOJO 1.7 as per product documentation if I am not wrong. And if so dojo.addOnLoad() should not work but it's working and require function not working. Just bit confused here. Curious to know which version of dojo it's referring to.

      Thanks a lot again.....

      • mburati
        mburati
        2551 Posts
        ACCEPTED ANSWER

        Re: DOJO not getting enabled

        ‏2013-06-17T14:00:59Z  in response to NiladriChakraborty

        The require API appears to take an array of strings, not a single string, as your sample was passing:

            http://dojotoolkit.org/reference-guide/1.7/dojo/ready.html

        Try changing your:

            require("dojo/ready", function(ready){

        to:

            require(["dojo/ready"], function(ready){

        That made your sample work for me, for both your alerts.

        Note, to see the version of Dojo in use, you can just add it to your alert, or use the browser console to look at dojo.version.toString()

             alert("hi2... " + dojo.version.toString());

        Note,  if you are buildilng a portlet that you may deploy to an older version of portal (eg, older than WP8) then you should be careful not to hard code references to newer Dojo APIs that may not exist on the older version of portal that your portlet will be used on.   If you're only using Portal 8.0 or later, then it should be ok to reference Dojo 1.7 APIs directly.      Note, I believe that IBM Portal 8.0 (and thus Web Experience Factory 8) still use the synchronous loader,  for compat with existing portlets/customer integrations that don't yet support the newer Dojo amd  loader.

         

        I hope that info helps,
        ..Mike Burati 
        The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.