4 replies Latest Post - ‏2009-12-02T17:21:25Z by SystemAdmin
181 Posts

Pinned topic Creating a Iwidget with dojo

‏2009-11-27T15:06:38Z |

I am quite new to iwidget development. I am trying to create a simple iwidget using dojo capability. I am following an article from lotus connection which is The problem i am having is understanding the dojo.registerModulePath('DojoHello','servername/DojoHello'). 'll print the small files below and then try to explain my problem

I created the dojo.xml file (widget definition file). Which looks like below*

<iw:iwidget name="helloWorld"
<iw:resource uri="helloworldfunction.js" />
<iw:content mode="view">
<div id="helloWorld">
Then i have this helloworldfunction.js, which looks like below*


*var helloWorld = {**
*dhw: null,**
*onLoad: function() {**
*var container = this.iContext.getElementById('helloWorld');**
*this.dhw=new DojoHello.helloWorld({iContext:this.iCOntext});**

Now above the line dojo.registerModulePath('DojoHello','servername/DojoHello');

where does it start looking from?. I know in a plain dojo application it starts relative to where dojo.js file is, but here where i am deploying it to a IBM mashup server in my local machine. Where should i place that perticular file? should it be part of the war file? What would be the absouloute path would look like if i have placed the file under Webcontent/ in the war file?

This might sound very basic question but i am having trouble in understaning this. Any help would be much appreciated.

Please let me know if you require any further information
Updated on 2009-12-02T17:21:25Z at 2009-12-02T17:21:25Z by SystemAdmin
  • LuisBenitez
    2 Posts

    Re: Creating a Iwidget with dojo

    ‏2009-11-30T18:02:24Z  in response to SystemAdmin
    Check out the widget that I did for (attached). Hopefully, that sample code will clear up any dobuts. If you still have questions, let me know.
    • SystemAdmin
      181 Posts

      Re: Creating a Iwidget with dojo

      ‏2009-12-01T11:38:15Z  in response to LuisBenitez

      Thanks for looking at it. your example does shed light for me. where i am confused is, in your example .js file you have coded as

      Which pingFmWidget is it refering in line 1?
      I know dojox/encoding/base64.js' is part of the dojo package. Do i need to add this as part of the war file i am deploying to mashup? or does mashup has dojo installed on it?

      my whole confusion is where does dojo packages reside in lotus mashups? and how do i referenc it?

      I am not sure whether it shounds trivial but it is confusing me a lot :(

      I have attached a war file i am trying to deploy to mashups.
      • LuisBenitez
        2 Posts

        Re: Creating a Iwidget with dojo

        ‏2009-12-01T21:56:34Z  in response to SystemAdmin

        dojo.provide("pingFmWidget") means that I'm declaring/defining pingFmWidget. In other words, my .js file is the definition of the pingFmWidget "class". Think of Java and how you have to define the class name near the top of the file. That's the same thing that I'm doing here.

        Where the package resides, should be irrelevant. For mashups, you point to an iWidget XML. As long as the server has access to that server, the mashup server should be able to run the widget. That's the beauty of this. So for example, I have a widget located at: and the .js file is in the same directory as the XML.

        Now, any server with access to the internet will be able to run that widget.

        I hope I'm making sense..
        • SystemAdmin
          181 Posts

          Re: Creating a Iwidget with dojo

          ‏2009-12-02T17:21:25Z  in response to LuisBenitez
          Hi Luis

          Thank you ever so much for clearing this problem. It kind of make sense to me now, but to clear it fully I want to go there step by step. ie: start with a simple js file doing basic script function on click etc.

          The one thsta i started is to have a java script file and then to read the value in the xml file dom node value and alert it with that text on click of a hyper link


          The above doesnt work for some reason. what i can see is when i just alert with a plain text "hello" it works so it shows me that it is seeing the .js file. when ever i am using the icontext it doesnt work. I have defined iscop within iw:iwidget as well. every thing seems to be right from my side. This is a very basi widget and it is straight from a wiki.

          I have attached the war file here. can you please have a look at it ? I am unable to reaolve this. spent the whole of today to look at it?