How to run onLoad event for a Dojo Dialog?

我的未来我决定 提交于 2021-02-07 18:13:33

问题


I have a Dojo dialog with content coming in from an ajax call. In the dialog I need an onLoad event (with parameters that are available only after the ajax call - so I cannot have the function called before myDialog.show() ) The onLoad event that I have in the body tag of my jsp which is the response from the ajax call is not being called - <body onload="new_record(${record_size}, '${id}')"> Any help/hint would be very nice. Thanks.


回答1:


Dijit dialog supports an onShow method - you can do your AJAX pull of the dialog content in the onShow method and then populate the dialog contents.

Note that dialog content is usually embedded inside a dijit contentpane or a div

dojo.connect(myDialog, "onShow", null, function(e) {
   //do AJAX call
   // in the callback function, populate the dialog contents
});

Also see http://www.ibm.com/developerworks/web/tutorials/wa-dojotoolkit/section7.html for an example

hth



来源:https://stackoverflow.com/questions/9091260/how-to-run-onload-event-for-a-dojo-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!