tags:

views:

180

answers:

1

Hi, I'm new to Dojo world. I tried to create a custom dojo widget from scratch.The problem that I'm facing is the widget is not getting parsed. I see that postCreate method of that widget is not getting called. The widget JS file is being downloaded from the server.

Here are the steps what I followed.

  1. Created a javascript file CustomWidget.js in test folder.

    dojo.provide('test.CustomWidget'); dojo.require('dijit._Widget');

    dojo.declare('test.CustomWidget',dijit._Widget, { text:"Hello World",

     postCreate:function()
     {
      console.log(this.text+'text');
      this.domNode.innerHTML=this.text;
     }
    
    
    });
    
  2. In my jsp file,I imported test.CustomWidget using dojo.require.


    dojo.require('mindtree.CustomWidget'); dojo.addOnLoad(function(){dojo.parser.parse("addFavorites");});

I can see that CustomWidget.js file is being downloaded, but I don't see the console statement being printed. Can someone plese help me?

Thanks in advance Mahi

+1  A: 

Looks like you aren't instantiating the widget, do you have code like this somewhere?

<div dojoType="mindtree.CustomWidget">...</div>

Otherwise it's like declaring a class but never calling new.

Bill Keese