Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why dojo 1.7 can't show dialog?

I followed the dojo tutorial to show a "Terms and Conditions" dialog. The dojo version is 1.7.0. I tested the example in chrome. In my test page I right click to show a menu then select item "Inspect Element". I found an error message in tab console. The error message is:

Uncaught TypeError: Cannot call method 'show' of undefined
showDialogdialog
(anonymous function)
onclickdialog

Then I go to the dojo api page. I find dojo 1.7.0 no any methods under the class dijit.Dialog. So how to show dialog use dojo 1.7.0? Any idea? Thank you so much.

like image 911
Zhihau Shiu Avatar asked Oct 09 '22 07:10

Zhihau Shiu


1 Answers

It seems to be a problem with Google CDN, because the tutorial example works fine with the local copy of Dojo 1.7.

Dojo loader loads the file Dialog.js, but cannot parse it, which results in "parser.js: 8 Uncaught Error: Could not load class 'dijit.Dialog'".

dijit.Dialog.show() method is missing because the Dialog widget is not instanced and dijit.byId("terms") returns "undefined".

To workaround this load dijit.Dialog class/file via script tag:

<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.7.0/dijit/Dialog.js"></script>

I filled this issue into Dojo bug tracker: Ticket #14415.

like image 183
phusick Avatar answered Oct 11 '22 21:10

phusick