Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

initialization of dojo widget

I tried to create custom widget for my site. when I loaded page it says: mixin #0 is not a callable constructor. clsInfo.cls.prototype is undefined I can't find any information about clsInfo, so I don't know what is it. maybe the problem that I use dojo from google:

and my own script is located on localhost. so when my dojo on page initializes something goes wrong with my script. I can't find any good info on dojo, maybe I search in wrong places? please help me to resolve my problem

like image 650
second_ffgf Avatar asked Jan 02 '26 08:01

second_ffgf


1 Answers

I ran into this when I was trying to override a dijit.Dialog so I could bind events to controls within it. We've yet to see if the binding part will work, but if you look at the source, this happens when one of the bases passed in as the second argument fails to resolve to an "[Object function]". In my case, I was passing a String in.

dojo.declare takes 3 arguments:

  • The name of the custom object "class" you're building
  • An array of base classes, parents to provide functionality (not the string names of those classes)
  • A hash of functions and declarations

So if I want to override dijit.Dialog, I have to do:

dojo.declare("myDialogType", [dijit.Dialog], {
    function1() {/*Code*/},
    function2() {/*Code*/}
}

I had ["dijit.Dialog"] as my second argument and that was the problem.

I strongly recommend using Web Inspector or Firebug with uncompressed local copies of the Dojo library rather than the CDN to figure out what's going on and debug these types of problems. Dojo's documentation is extensive but not complete in some areas and some behaviors have to be figured out by looking at what the code expects. That's not intended as a slight to the authors; once you get it going it's a pretty awesome product, and any documentation for volunteer work is appreciated.

like image 175
brokenbeatnik Avatar answered Jan 03 '26 21:01

brokenbeatnik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!