AnsweredAssumed Answered

AMD Dojo Object not returning what it SHOULD be

Question asked by evtguy on Jul 16, 2015
Latest reply on Jul 17, 2015 by timw1984

So I'm neck deep in migrating a legacy app to AMD style and I've run into this once or twice but here's the most recent example. In my legacy app, this was a seperate JS file which simply opens a Dojo dialog containing some help/instructional content about the app and had a button to open a PDF help document. Nothing earth shattering here. I've converted it to an AMD module and it (seems) to load fine:


define ([
], function (
    array, connect, declare, has, Dialog, Button, place
) {
    return declare(null,{
        showHelp: function() {
            var htmlFragment = '<some html formatted content>';
            // Create the help dialog
            var dialogBox = new Dialog({
                id: "helpDlg",
                title: "About my app",
                content: htmlFragment,
                style: "width:960px;height:585px;background:#FFFFD4",
                autofocus: !has("ie"), // NOTE: turning focus ON in IE causes errors when reopening the dialog
                refocus: !has("ie")

            var btn = new Button({ label: "Close Help", style: "float:right;padding:10px 25px 10px 0px;font-weight:bold" });

            connect.connect(btn, "onClick", function(){

            var btn2 = new Button({ label: "Open PDF User Guide", style: "float:left;padding:10px 0px 10px 25px;font-weight:bold" });

            connect.connect(btn2, "onClick", function(){
      "http://some.pdf", 'resizable,scrollbars');

            // Display the dialog

When I click the button on my HTML page that fires off showHelp, I get "Uncaught TypeError: Cannot read property 'appendChild' of undefined."


When I pause my code to examine the dialog object, it CLEARLY does not match what the API specifies it should:



I've tried "dijit/Dialog" and "dojox/widget/Dialog" but it's always the same result. The dojo version loaded is 1.10.x (I'm referencing ESRI's CDN URL for the JS API and dojo, BTW). The easy, short term answer is to just continue to use dijit.Dialog but I want to know WHY I'm not seeing the proper dijit/Dialog that I should be seeing.


Any ideas?